Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
2 answers
719 views
How to generate full-page QR code from command line?
I'd like to generate a full-page QR code from the command line. The following command sort of accomplishes this: qrencode -o- https://example.net | convert png:- -gravity center -units pixelsperinch -density 300 -resize 2551x3295 -extent 2551x3295 qrcode.pdf Unfortunately, the resulting QR code is q...
I'd like to generate a full-page QR code from the command line. The following command sort of accomplishes this: qrencode -o- https://example.net | convert png:- -gravity center -units pixelsperinch -density 300 -resize 2551x3295 -extent 2551x3295 qrcode.pdf Unfortunately, the resulting QR code is quite blurry, as though imagemagick is doing some sort of unwanted antialiasing. Is there a way to make the code completely crisp, or just a better/simpler approach to generating a PDF file with a full-page QR code?
user3188445 (5539 rep)
Apr 3, 2024, 06:13 PM • Last activity: Aug 6, 2025, 02:43 PM
0 votes
1 answers
32 views
visualize "diff" of images using imagemagick without postprocessing effect
I'm comparing 2 images using imagemagic (`compare a.png b.png -compose src diff.png`): [![enter image description here][1]][1] [![enter image description here][2]][2] They don't look much different at all. Yet the diff image from imagemagick-compare is so hard to read: [![enter image description her...
I'm comparing 2 images using imagemagic (compare a.png b.png -compose src diff.png): enter image description here enter image description here They don't look much different at all. Yet the diff image from imagemagick-compare is so hard to read: enter image description here How can I just visualize simply the abs(pixel_a - pixel_b) of 2 images without introducing those postprocessing and rescaling effect? I imagine for this specific case the diff image should be mostly dark with a few grey points.
Rahn (289 rep)
Jul 19, 2025, 01:29 AM • Last activity: Jul 20, 2025, 03:15 PM
0 votes
1 answers
2150 views
how to find all pics in a directory and its subdirectories and run a command on them
how to find all images in a directory and its sub-directories, with types ```gif, jpg, jpeg, png, ico```, and run ```mogrify -strip your_filename.jpg``` on them? Can the command ```mogrify -strip``` corrupt an image? Also can the command ```mogrify -strip``` be run on a gif file?
how to find all images in a directory and its sub-directories, with types
, jpg, jpeg, png, ico
, and run
-strip your_filename.jpg
on them? Can the command
-strip
corrupt an image? Also can the command
-strip
be run on a gif file?
stacking and exchanging woohoo (63 rep)
Dec 13, 2022, 10:47 PM • Last activity: Jun 24, 2025, 02:04 PM
4 votes
2 answers
2305 views
How can you compress images in a PDF?
How can you increase the JPEG compression level on a PDF using batch tools under Linux? Obviously you can use `gs -dPDFSETTINGS=/screen` or `/ebook`, but that downsamples the PDF - it reduces the DPI. It's more efficient (in terms of how nice the PDF looks per KB) to use JPEG compression while retai...
How can you increase the JPEG compression level on a PDF using batch tools under Linux? Obviously you can use gs -dPDFSETTINGS=/screen or /ebook, but that downsamples the PDF - it reduces the DPI. It's more efficient (in terms of how nice the PDF looks per KB) to use JPEG compression while retaining the same pixel count. E.g.: https://docupub.com/pdfcompress/ allows you to half the size of a PDF yet when you zoom in it still has good quality, albeit with some artifacts. When you zoom in using gs's /ebook mode, it inevitably looks more pixelated. What Linux tool allows us to apply JPEG compression to each image in a PDF? Is there any way to use ImageMagick's convert -quality on a PDF of multiple images?
Zaz (2654 rep)
Jan 8, 2021, 06:35 PM • Last activity: May 11, 2025, 09:07 AM
0 votes
2 answers
54 views
why does magick command involving libtiff fail after upgrading linux mint?
I recently upgraded to Linux Mint 22.1 Cinnamon, and an ImageMagick script now throws an error: magick: symbol lookup error: /usr/local/lib/libMagickCore-7.Q16HDRI.so.10: undefined symbol: TIFFFieldDataType, version LIBTIFF_4.0 in `/usr/local/lib` I notice that `libMagickCore-7.Q16HDRI.so.10` is a s...
I recently upgraded to Linux Mint 22.1 Cinnamon, and an ImageMagick script now throws an error: magick: symbol lookup error: /usr/local/lib/libMagickCore-7.Q16HDRI.so.10: undefined symbol: TIFFFieldDataType, version LIBTIFF_4.0 in /usr/local/lib I notice that libMagickCore-7.Q16HDRI.so.10 is a symbolic link pointing to libMagickCore-7.Q16HDRI.so.10.0.0 The ImageMagick version I installed from synaptic. I do not remember if I have ever tried installing a build from outside synaptic. magick -version Version: ImageMagick 7.1.0-43 Q16-HDRI x86_64 8718d6292:20220709 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP(4.5) Delegates (built-in): fontconfig freetype jbig jng jpeg lcms lzma pangocairo png tiff x xml zlib Compiler: gcc (9.4) magick -list format TIFF* rw+ Tagged Image File Format (LIBTIFF, Version 4.5.1) TIFF64* rw+ Tagged Image File Format (64-bit) (LIBTIFF, Version 4.5.1) I have installed libtiff-dev libtiff5-dev and libtiff6 In searching this issue online I randomly tried following advice conda uninstall libtiff but that only returns PackagesNotFoundError: The following packages are missing from the target environment: - libtiff Any ideas on how to solve this would be greatly appreciated.
ItHertz (97 rep)
Mar 31, 2025, 12:51 AM • Last activity: Apr 3, 2025, 01:13 AM
2 votes
2 answers
1246 views
How to extract comment from ppm file?
I have ppm file X.ppm with comment : xxd X.ppm|head -10 0000000: 5036 0a23 206d 6967 6874 796d 616e 6465 P6.# mightymande 0000010: 6c20 2d32 2e38 3034 3132 3232 3037 3833 l -2.80412220783 0000020: 3834 3132 3833 3535 3139 3235 652d 3032 841283551925e-02 0000030: 202b 2036 2e39 3438 3932 3238 3438 31...
I have ppm file X.ppm with comment : xxd X.ppm|head -10 0000000: 5036 0a23 206d 6967 6874 796d 616e 6465 P6.# mightymande 0000010: 6c20 2d32 2e38 3034 3132 3232 3037 3833 l -2.80412220783 0000020: 3834 3132 3833 3535 3139 3235 652d 3032 841283551925e-02 0000030: 202b 2036 2e39 3438 3932 3238 3438 3134 + 6.94892284814 0000040: 3730 3430 3430 3831 3238 3631 652d 3031 704040812861e-01 0000050: 2069 2040 2034 2e34 3430 3839 3230 3938 i @ 4.440892098 0000060: 3530 3036 3237 3165 2d31 360a 3132 3830 5006271e-16.1280 0000070: 2037 3230 0a32 3535 0aff ffff ffff ffff 720.255........ 0000080: ffff ffff ffff ffff ffff ffff ffff fefe ................ 0000090: fefc fcfc f8f8 f8e8 e8e8 4141 4140 4040 ..........AAA@@@ It is created with c code : void record_write(FILE *out, unsigned char *buffer, int width, int height, mpfr_t centerx, mpfr_t centery, mpfr_t radius) { fprintf(out, "P6\n"); mpfr_fprintf(out, "# mightymandel %Re + %Re i @ %Re\n", centerx, centery, radius); fprintf(out, "%d %d\n255\n", width, height); fflush(out); for (int y = height - 1; y >= 0; --y) { fwrite(buffer + y * width * 3, width * 3, 1, out); } fflush(out); } I can convert it to png : xxd X.png|head -10 0000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 .PNG........IHDR 0000010: 0000 0500 0000 02d0 0802 0000 0137 187a .............7.z 0000020: 9700 0000 5f74 4558 7454 6974 6c65 002d ...._tEXtTitle.- 0000030: 322e 3830 3431 3232 3230 3738 3338 3431 2.80412220783841 0000040: 3238 3335 3531 3932 3565 2d30 3220 2b20 283551925e-02 + 0000050: 362e 3934 3839 3232 3834 3831 3437 3034 6.94892284814704 0000060: 3034 3038 3132 3836 3165 2d30 3120 6920 040812861e-01 i 0000070: 4020 342e 3434 3038 3932 3039 3835 3030 @ 4.440892098500 0000080: 3632 3731 652d 3136 aba5 7721 0000 0015 6271e-16..w!.... 0000090: 7445 5874 536f 6674 7761 7265 006d 6967 tEXtSoftware.mig It also contain comment, but : - It is not exif ( and ppm is not supported by eviv2 library ). - Gimp also do not show comment from ppm or png file ( why ?) - identify -verbose X.ppm shows comment What program should I use to extract comment from ppm files ?
Adam (1019 rep)
Dec 23, 2014, 04:24 PM • Last activity: Feb 26, 2025, 11:13 PM
0 votes
2 answers
61 views
Does convert from imagemagick misinterpret the resolution- or density-related metadata of PNG?
Let's grab a DIN A4 paper sheet in PNG format from https://www.a4-size.com/download/335/?tmstv=1739899566 . After unpacking the obtained archive, we get a4-size-portrait-pixels-600dpi.png. Let's inspect its meta data: ```bash $ exiftool a4-size-portrait-pixels-600dpi.png ExifTool Version Number : 12...
Let's grab a DIN A4 paper sheet in PNG format from https://www.a4-size.com/download/335/?tmstv=1739899566 . After unpacking the obtained archive, we get a4-size-portrait-pixels-600dpi.png. Let's inspect its meta data:
$ exiftool a4-size-portrait-pixels-600dpi.png 
ExifTool Version Number         : 12.57
File Name                       : a4-size-portrait-pixels-600dpi.png
Directory                       : .
File Size                       : 5.2 kB
File Modification Date/Time     : 2020:08:28 10:46:09+02:00
File Access Date/Time           : 2025:02:18 18:47:15+01:00
File Inode Change Date/Time     : 2025:02:18 18:43:03+01:00
File Permissions                : -rw-r--r--
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 4961
Image Height                    : 7016
Bit Depth                       : 1
Color Type                      : Palette
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Palette                         : 255 255 255
Image Size                      : 4961x7016
Megapixels                      : 34.8
As we see, the resolution/density tags are missing. So let's add them, using https://unix.stackexchange.com/a/791125 :
$ dpi=600 && exiftool -o a4-size-portrait-pixels-600dpi.exiftool.png -XResolution=$dpi -YResolution=$dpi -ResolutionUnit=inches -PixelsPerUnitX=$(( dpi * 10000 / 254 )) -PixelsPerUnitY="$(( dpi * 10000 / 254 ))" -PixelUnits=meters a4-size-portrait-pixels-600dpi.png 
    1 image files created
But now:
$ convert a4-size-portrait-pixels-600dpi.exiftool.png -density 600 a4-size-portrait-pixels-600dpi.exiftool.convert.pdf
$ pdfinfo a4-size-portrait-pixels-600dpi.exiftool.convert.pdf
Title:           a4-size-portrait-pixels-600dpi.exiftool.convert
Producer:        https://imagemagick.org 
CreationDate:    Tue Feb 18 18:55:03 2025 CET
ModDate:         Tue Feb 18 18:55:03 2025 CET
Custom Metadata: no
Metadata Stream: no
Tagged:          no
UserProperties:  no
Suspects:        no
Form:            none
JavaScript:      no
Pages:           1
Encrypted:       no
Page size:       234.378 x 331.465 pts
Page rot:        0
File size:       35775 bytes
Optimized:       no
PDF version:     1.3
As we see, the page size is wrong. In Postscript points, the right size would have been 595 × 842 pts. What's going on here? Are we overusing exiftool+convert, or is convert simply wrong? We might suspect that we shouldn't need to tell the toolchain the density/resolution more than once. However, (in the ideal world) you should be able to say as often as you wish how big your pixel or your dot is (in our case, 1/600 of an inch wide and 1/600 of an inch high) to any tool in the toolchain.
AlMa1r (1 rep)
Feb 18, 2025, 06:00 PM • Last activity: Feb 24, 2025, 08:59 PM
2 votes
2 answers
756 views
How can I convert an animated gif to indivual frames and then back again to animated gif?
I want to manually modify an animated gif. So I'm trying to convert it to individual (editable) frames, after which I can draw my modification and then re-assemble the frames. First I convert a 31 seconds long mp4 to animated gif : ``` ffmpeg -i Daisies.mp4 -r 15 -vf scale=512:-1 -ss 00:00:03 -to 00...
I want to manually modify an animated gif. So I'm trying to convert it to individual (editable) frames, after which I can draw my modification and then re-assemble the frames. First I convert a 31 seconds long mp4 to animated gif :
ffmpeg   -i Daisies.mp4   -r 15   -vf scale=512:-1   -ss 00:00:03 -to 00:00:06   DaisiesOK.gif
This animated gif is OK. Then I convert this animated gif to individual frames :
magick convert DaisiesOK.gif Daisies.png
The first frame looks OK, except it's in 256 colors, but the next ones are very pale, full of transparent pixels. These frames to animated gif :
magick convert -delay 20 -loop 0 *.png Daisies.gif
Gives a very ugly video, the daisies have white "shadows", the place where they started from (they're swaying) stays imprinted with white daisy edges. If I try to use jpeg instead of png, it's even worse, most of the video is just black. How can I extract the frames preserving all the color information? Does the problem come from imagemagick or from ffmpeg?
Alain Reve (123 rep)
Feb 9, 2025, 05:50 PM • Last activity: Feb 13, 2025, 11:26 AM
1 votes
1 answers
102 views
Should we use convert or img2pdf for creating lossless multi-page PDF files out of gray PNM photocopies? And why?
Let's assume that you have 4 scanned pages, created by `scanimage -resolution 1200` and postprocessed by GIMP: each page was rotated so that the text lines were horizontal, the bled-through text was removed, and the margins were removed. You would like to losslessly create a single 4-page PDF docume...
Let's assume that you have 4 scanned pages, created by scanimage -resolution 1200 and postprocessed by GIMP: each page was rotated so that the text lines were horizontal, the bled-through text was removed, and the margins were removed. You would like to losslessly create a single 4-page PDF document out of the 4 pages. Here is what you tried:
$ sum_sofar=0; for file in $(for i in $(seq 1 4); do echo page_$i.pnm; done | xargs echo); do sum_sofar=$((sum_sofar + $(stat -c%s "$file"))); done; echo "The sum of the sizes of the PNM files is $sum_sofar bytes."
The sum of the sizes of the PNM files is 415300162 bytes.
$ convert $(for i in $(seq 1 4); do echo page_$i.pnm; done | xargs echo) -compress Zip -quality 100 -density 1200 tmp_output_document.convert.pdf && pdftk tmp_output_document.convert.pdf update_info  Producer:        https://imagemagick.org 
> CreationDate:    …
> ModDate:         …
16,17c16,17
 File size:       254364579 bytes
> Optimized:       no
(Above, you dropped the timestamps for simplicity.) Inspection with diffpdf reveals no differences. Both img2pdf and convert produce, in your understanding, lossless files, don't they? So why do the sizes differ by a factor of 254369508/201800756 ≈ 1,26 ? What does it mean that file created by img2pdf file is “optimized”, whereas the file created by convert is not? For lossless storage, which method is better: img2pdf or convert+pdftk, and how to use it properly™?
AlMa1r (1 rep)
Feb 2, 2025, 02:56 AM • Last activity: Feb 2, 2025, 08:10 PM
4 votes
3 answers
1245 views
Command line glob to view multiple images using ImageMagick's display
How can I open multiple images files using ImageMagick's `display` command? If I enter say `display *.png` in a directory containing multiple PNG files, only one is displayed. I think I'd prefer them to appear one at a time, but all at once could be useful too.
How can I open multiple images files using ImageMagick's display command? If I enter say display *.png in a directory containing multiple PNG files, only one is displayed. I think I'd prefer them to appear one at a time, but all at once could be useful too.
user7543 (274 rep)
Sep 30, 2023, 10:01 PM • Last activity: Jan 28, 2025, 07:09 AM
0 votes
1 answers
72 views
Error when installing ImageMagick with perlbrew
I am trying to install ImageMagick for `perlbrew` as an application needed a higher version of Perl than the one that came with my Ubuntu, and this application also needs to use ImageMagick. I am on ubuntu jammy and I am using _Perl 5.36.3_ with `perlbrew`. When I try to install ImageMagick with `pe...
I am trying to install ImageMagick for perlbrew as an application needed a higher version of Perl than the one that came with my Ubuntu, and this application also needs to use ImageMagick. I am on ubuntu jammy and I am using _Perl 5.36.3_ with perlbrew. When I try to install ImageMagick with perlbrew, I get this error:
cpan> install Image::Magick
Reading '/home/me/.cpan/Metadata'
  Database was generated on Thu, 09 Jan 2025 03:17:02 GMT
Running install for module 'Image::Magick'
Checksum for /home/me/.cpan/sources/authors/id/J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz ok
Scanning cache /home/me/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lMagickCore-7.Q16HDRI
Generating a Unix-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
  JCRISTY/Image-Magick-7.1.1-28.tar.gz
  /home/me/perl5/perlbrew/perls/perl-5.36.3/bin/perl Makefile.PL -- OK
Running make for J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz
cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Magick ()
chmod 644 "Magick.bs"
"/home/me/perl5/perlbrew/perls/perl-5.36.3/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Magick.bs blib/arch/auto/Image/Magick/Magick.bs 644
"/home/me/perl5/perlbrew/perls/perl-5.36.3/bin/perl" "/home/me/perl5/perlbrew/perls/perl-5.36.3/lib/5.36.3/ExtUtils/xsubpp"  -typemap '/home/me/perl5/perlbrew/perls/perl-5.36.3/lib/5.36.3/ExtUtils/typemap' -typemap '/home/me/.cpan/build/Image-Magick-7.1.1-3/typemap'  Magick.xs > Magick.xsc
mv Magick.xsc Magick.c
cc -c  -I/usr/local/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-7" -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2   -DVERSION=\"7.1.1\" -DXS_VERSION=\"7.1.1\" -fPIC "-I/home/me/perl5/perlbrew/perls/perl-5.36.3/lib/5.36.3/x86_64-linux/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs:56:10: fatal error: MagickCore/MagickCore.h: No such file or directory
   56 | #include 
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:351: Magick.o] Error 1
  JCRISTY/Image-Magick-7.1.1-28.tar.gz
  /usr/bin/make -- NOT OK
Failed during this command:
 JCRISTY/Image-Magick-7.1.1-28.tar.gz         : make NO
stacking and exchanging woohoo (63 rep)
Jan 9, 2025, 06:54 AM • Last activity: Jan 22, 2025, 01:13 PM
0 votes
2 answers
431 views
ImageMagick on Fedora will not read HEIC images created with iOS 18
When trying to convert recently created HEIC files to jpg on my Fedora system, I get the following error message: `magick: Invalid input: Unspecified: Too many auxiliary image references (2.0)` Apparently, there is a fix for this in libheif 1.18.2, but this is not yet available on Fedora. How can I...
When trying to convert recently created HEIC files to jpg on my Fedora system, I get the following error message: magick: Invalid input: Unspecified: Too many auxiliary image references (2.0) Apparently, there is a fix for this in libheif 1.18.2, but this is not yet available on Fedora. How can I get around this? Is there a different workaround? Since I can mount the folder in question from a Windows client, is there a Windows program that would let me batch convert these files?
Lars Poulsen (357 rep)
Jan 11, 2025, 07:50 PM • Last activity: Jan 13, 2025, 07:55 PM
1 votes
1 answers
116 views
In ImageMagick, how to create a PDF file from an image with the best Flate compression ratio?
Assume you have a PNM or PNG image file, gray or color. With ImageMagick, you wish to generate a possibly small PDF file from it without losing information. So far I though it is simply convert infile.pnm -quality 100 -compress Zip outfile.pdf or convert infile.png -quality 100 -compress Zip outfile...
Assume you have a PNM or PNG image file, gray or color. With ImageMagick, you wish to generate a possibly small PDF file from it without losing information. So far I though it is simply convert infile.pnm -quality 100 -compress Zip outfile.pdf or convert infile.png -quality 100 -compress Zip outfile.pdf Is that it? After testing, I'm no longer sure that the compression is lossless.
AlMa1r (1 rep)
Dec 19, 2024, 06:50 PM • Last activity: Dec 20, 2024, 03:53 PM
0 votes
1 answers
152 views
Convert (ImageMagick) ignores quality level setting when converting to webp in Mint 22
I've been using `convert` to recompress images to webp for publication. My command line is: convert -quality 70 input.jpg test.webp This works in Mint 20 (ImageMagick 6.9.10-23), but in Mint 22 (ImageMagick 6.9.12-98) the -quality flag seems to do nothing at all. Whether I say -quality 1 or -quality...
I've been using convert to recompress images to webp for publication. My command line is: convert -quality 70 input.jpg test.webp This works in Mint 20 (ImageMagick 6.9.10-23), but in Mint 22 (ImageMagick 6.9.12-98) the -quality flag seems to do nothing at all. Whether I say -quality 1 or -quality 99, I get the same result. However, -quality 100 produces a gigantic (I assume uncompressed image)
SurpriseDog (662 rep)
Dec 19, 2024, 10:41 PM • Last activity: Dec 19, 2024, 11:35 PM
64 votes
9 answers
96310 views
convert images to pdf: How to make PDF Pages same size
I did something like convert -page A4 -compress A4 *.png CH00.pdf But the 1st page is much larger than the subsequent pages. This happens even though the image dimensions are similar. These images are scanned & cropped thus may have slight differences in dimensions I thought `-page A4` should fix th...
I did something like convert -page A4 -compress A4 *.png CH00.pdf But the 1st page is much larger than the subsequent pages. This happens even though the image dimensions are similar. These images are scanned & cropped thus may have slight differences in dimensions I thought -page A4 should fix the size of the pages?
Jiew Meng (2523 rep)
Sep 3, 2011, 04:02 AM • Last activity: Dec 19, 2024, 04:49 PM
2 votes
4 answers
124 views
How to auto-rotate a rectangular image area by a few degrees so that its left border gets vertical (using command line tools like imagemagick)
I have several thousand images whose main characteristics are as in the attached picture: All images are in a (nearly) black frame, while the actual image content nearly always is on a white background. Now I would like to rotate the actual image content so that this content's left border is vertica...
I have several thousand images whose main characteristics are as in the attached picture: All images are in a (nearly) black frame, while the actual image content nearly always is on a white background. Now I would like to rotate the actual image content so that this content's left border is vertical. Then I would like to crop (trim) the image so that the black border is thrown away, but keeping the actual content completely. That is, even if the area that holds the actual content is not perfectly rectangular, everything from that area must be kept, which means that small rests of the black frame could still be visible afterwards. Given the number of images that I'd like to treat this way, I guess I'll have to do that using command line tools. In the past, I have used ImageMagick for that kind of jobs (for transformations that are a lot easier), but I really wouldn't mind combining several different tools to achieve the task. What I have already tried: I have researched how to deskew images, and this works most time. However, the deskewing methods I have found work *by making text lines horizontal.* This is nice because it makes reading easier, but of course in most cases the borders of the area that hold the text are not vertical or horizontal afterwards, respectively. That's not what I am after. To explain in more, detail, I would like to: 1. Detect the left edge between the black frame and the area that holds the actual image content. 2. Fit a (invisible) straight line along that edge. 3. Determine the angle between that line and a vertical line. 4. Rotate the whole image by (the negative) of that angle so that the edge from step 1 becomes vertical. 5. Trim the image, throwing away as much of the black frame as possible, but thereby keeping the complete area that holds the actual content (and thus accepting that rests of the black frame are kept if that area is not perfectly rectangular). Could somebody explain how to do this, preferably using command line tools? enter image description here
Binarus (3891 rep)
Nov 17, 2024, 11:19 AM • Last activity: Nov 27, 2024, 06:39 AM
1 votes
2 answers
724 views
How to use ImageMagick's convert to rescale an image, adding letterboxing to produce a fixed size result?
I have some arbitrarily-sized images for which I want to produce fixed-size 800x600 thumbnails, which keep the original image ratio and add white letterboxing to make up the rest of the space. I'd like the letterboxing to be as minimal as possible, which means that the process would do the following...
I have some arbitrarily-sized images for which I want to produce fixed-size 800x600 thumbnails, which keep the original image ratio and add white letterboxing to make up the rest of the space. I'd like the letterboxing to be as minimal as possible, which means that the process would do the following: - choose whichever axis is largest - if x is largest, scale the image (keeping the ratio) so that new x is 800. - if y is largest, scale the image (keeping the ratio) so that new y is 600. - the result, at this point, will not be 800x600 (unless the original happened to be exactly 4:3 ratio), so centre the result in an 800x600 rectangle and add a white background. I can do the first 3 steps with convert -resize 800x600 $input $output so I suppose I could overlay that on top of another image using some other imagemagick tool, but it would be great if I could do it in one hit. Anyone know if this is possible?
Max Williams (1157 rep)
Feb 29, 2016, 04:48 PM • Last activity: Nov 19, 2024, 08:46 AM
125 votes
7 answers
213740 views
Creating a GIF animation from PNG files
Is there a tool to create a `gif` animation from a set of `png` files? I tried the `convert` command from the [ImageMagick](http://www.imagemagick.org/) suite, but this doesn't always succeed. Also, I have several issues with this: 1. I can't tell what the progress is. 2. No matter what I try, the `...
Is there a tool to create a gif animation from a set of png files? I tried the convert command from the [ImageMagick](http://www.imagemagick.org/) suite, but this doesn't always succeed. Also, I have several issues with this: 1. I can't tell what the progress is. 2. No matter what I try, the -delay flag doesn't change the frame rate of the gif animation. 3. convert determines the frame order based upon the alphabetical order of the files names. This means that `name500.png will be placed right after name50.png and not after name450.png` I can fix this by adding 0's but this is annoying.
Yotam (2744 rep)
Nov 5, 2011, 06:01 PM • Last activity: Nov 15, 2024, 03:24 AM
0 votes
0 answers
49 views
Grainy texture overlay (not a physical screen protector) on the monitor screen
I have a Xiaomi Android device and there I have a setting to add a grainy screen texture and control the intensity of it. I like this feature as it gives a paperlike experience and is eye-comforting. So I wonder if there is any way to achieve the same effect on my desktop screen.
I have a Xiaomi Android device and there I have a setting to add a grainy screen texture and control the intensity of it. I like this feature as it gives a paperlike experience and is eye-comforting. So I wonder if there is any way to achieve the same effect on my desktop screen.
xyz (1 rep)
Sep 28, 2024, 08:01 PM • Last activity: Sep 28, 2024, 09:56 PM
1 votes
1 answers
52 views
ImageMagick: How do I define a colour as the first in the indexed colour map when using -kmeans?
I need a specific colour to be the first in the colour map when using `-kmeans` to reduce the amount of colours in an image. It's required by Unreal Engine 1 textures when defining a mask colour. This is all I've got so far: ```lang-bash magick "$PNG_FILE" -kmeans 255 "$PCX_FILE" ``` I can somewhat...
I need a specific colour to be the first in the colour map when using -kmeans to reduce the amount of colours in an image. It's required by Unreal Engine 1 textures when defining a mask colour. This is all I've got so far:
-bash
magick "$PNG_FILE" -kmeans 255 "$PCX_FILE"
I can somewhat accomplish it using the -define kmeans:seed-colors="#ff00ff" directive, but it worsens the output too much, as it prevents the seed colours from being sampled automatically.
Artifechs (13 rep)
Sep 13, 2024, 05:36 PM • Last activity: Sep 14, 2024, 06:40 PM
Showing page 1 of 20 total questions