Hot answers tagged

34

It's not clear what you mean by "quality loss". That could mean a lot of different things. Could you post some samples to illustrate? Perhaps cut the same section out of the poor quality and good quality versions (as a PNG to avoid further quality loss). Perhaps you need to use -density to do the conversion at a higher dpi: convert -density 300 file.pdf ...


20

Try using the -density option. The default resolution is 72 dots per inch. So try something like -density 300. For reference see -density in the ImageMagick command-line options documentation.


16

Google already provided the tool to decode webp images (in the libwebp package, your uploaed file works on Arch) dwebp file.webp -o abc.png For the encoding tool, check the cwebp command. And you might consider using this online tool.


13

I am almost certain that what you perceive as a loss of quality in the PDF, is just an effect of your PDF viewer's anti-aliasing feature. If you use evince to view the PDF, you can see the anti-aliasing feature automatically switched off at a certain zoom (300% in my quick test). You can see that vividly when you keep zooming in - you will notice that at ...


11

I'd agree with the accepted answer of -geometry +0+0 to remove extra tile space, and I'd add -mode Concatenate (under certain conditions). Also, once you have differing sizes with montage, it gets a bit difficult to discern between what is "tile background" (tile space) vs "frame" and "border" - I lose track myself often, so here is a small test case with ...


11

The other ExifTool suggestions are great if you want to remove or change specific sections. But if you want to just remove all of the metadata completely, use this (from the man page): exiftool -all= dst.jpg Delete all meta information from an image. You could also use jhead, with the -de flag: -de Delete the Exif header entirely. ...


10

There are quite a few issues with your code. First of all, you are parsing ls which is a Bad Idea. You also need to refer to the variable as $file as you point out and you should also quote it so it won't break on spaces. You are declaring num but it is never used. A safer way would be: find /tmp/p/ -name "DSC*.JPG" | while read file; do convert "$file" ...


9

found a solution: identify, part of the imagemagick package, does exactly what I need $ identify color.jpg > color.jpg JPEG 1980x650 1980x650+0+0 8-bit DirectClass 231KB 0.000u 0:00.000


9

If I understood you correctly, you want one animated gif that looks like 5 animated gifs playing in parallel, right? Imagemagick can do that (and much more). Probably even in one line of code, but I'll do it in several steps. Lets assume your gifs are called anim1.gif…anim5.gif and are each 100x100 pixels. #Combine anim1.gif and anim2.gif (first row) ...


9

I found these 2 method via Google, in this thread titled: Re: Flattening PDF Files at the UNIX Command Line. Method #1 - using Imagemagick's convert: $ convert orig.pdf flattened.pdf NOTE: The quality is reported to be so so with this approach. Method #2 - Using pdf2ps -> ps2pdf: $ pdf2ps orig.pdf - | ps2pdf - flattened.pdf NOTE: This method is ...


8

Using ImageMagick: $ convert -crop 800x1000 image.png cropped_%d.png Will create a sequence of files named cropped_1.png, cropped_2.png, and so on. References Tile Cropping, sub-dividing one image into multiple images ImageMagick v6 Examples -- Cutting and Bordering


8

Requirements ImageMagick Type the follow line to commmand prompt for intall ImageMagick: sudo apt-get install imagemagick Convert from jpegs to PDF: Go to the work directory (directory of jpegs): cd work/directory/path Convert the JPG files to PDF: convert *.jpg foo.pdf source : http://bitprison.net/jpg_to_pdf


8

Digikam Add all the photos to your collection. In the menu, select “Tools / Find duplicates”. This will look for duplicates accross your whole collection. Findimagedupes A command line tool. Pass all the images you want to compare on the command line. Geeqie (formerly gqview) In the menu, select “File / Find duplicate”. Drag and drop image files do the ...


7

Sounds like a job for the montage command. montage -tile 1 -geometry +0+0 *.jpg ../big.jpg


7

You want all your photos to be 6x4 with a width of 1024, right? That means they should be 683 pixels high. If that is correct, what you're looking for is ... convert <input_image> -resize 1024x683^ -gravity center -extent 1024x683 <output_image> ... where you would replace with the filename of the image you want to resize, and with the ...


7

Try something like this: montage file1.jpg file2.jpg -geometry +0+0 -background none output.jpg This will make the border between images as small as possible and whatever is there will be transparent. To see a demo of the difference using builtin images, try these and compare: $ montage rose: -resize 100x60 rose: -geometry +0+0 -background none ...


7

I'd use convert or mogrify from the ImageMagick suite. $ convert -resize 100x50 1.png 2.png # or # $ mogrify -resize 100x50 1.png convert takes a separate output filename; creating a separate file. mogrify doesn't take a separate output filename; modifying the file in place


6

A simple method using BASH's PE (Parameter Expansion) is for f in /tmp/p/DSC*.JPG do convert -rotate 90 "$f" "${f%.JPG}"_converted.JPG done


6

If you install the exiftool from CPAN you can run the following script, assuming that all your files are in a directory called "all" #!/bin/sh for i in all/*; do SPEC=`exiftool -t -s -d "%Y-%m-%d %H:%M:%S" -CreateDate "$i"` read X DATE <<<${SPEC} echo "$i:$DATE" touch -d "$DATE" "$i" done


6

Use exiftool instead: exiftool -ext '' '-filename<%f_${ImageSize}.${FileType}' . Would rename all the images in the current directory (.).


6

There are many more resize options in imagemagick. -scale looks like what you need. Also, do not use JPEG for pixel-perfect "miniatures"; use PNG instead (or if impossible, GIF). JPEG is designed for photos and uses lossy compression, resulting in distortion clearly noticeable after scaling your provided JPEG sample. This article on image scaling might ...


6

You can do this using the command convert from ImageMagick and Awk: convert *.png *.jp* -format '%w %h %f\n' info: | awk '$1==$2 { $1=$2=""; print substr($0, 3) }' The command above will output the list of images that have exactly the same number of pixels horizontally and vertically. If instead what you want to find is images that only visually ...


5

The mogrify command crops the image to a fixed size. It also removes any compression present in the image, mainly to avoid recompressing JPEG images and losing image quality. It also ensures the resulting TIFF is fully compatible with the baseline format. The result is that you will get very similarly sized files for each of your scans: x_pixels * y_pixels ...


5

Solved it using convert -crop geometry +repage: convert -crop 100%x20% +repage image.png image.png


5

Here is shell code (bash, ksh, or zsh) that may do what you want: image=clock.jpg size=$( identify -ping -format "%wx%h" "${image}" ) x_upb=${size%x*} y_upb=${size#*x} x_inc=10 y_inc=10 x_tile=100 y_tile=100 for ((x=0; x<x_upb; x+=x_inc)) do for ((y=0; y<y_upb; y+=y_inc)) do convert "${image}" -crop "${x_tile}x${y_tile}+${x}+${y}" ...


5

You can start like this: for i in "$@"; do dst="${i%pdf}jpg" convert "$i" -resize 612x792 "$dst" convert "$i" -resize 255x330 "${i%.pdf}_thump.jpg" done And call it like $ bash my_script.sh *.pdf For renaming you can use another script. I don't understand your example .csv-file. Does is contain 3 lines for 3 files? Ok, this is the case. You can ...


5

ImageMagick provides a super-nice set of command-line tools for image manipulation. Check it out at http://www.imagemagick.org/.


5

you can just use the command "file" to get the informations you need: ~# file cha_2.png cha_2.png: PNG image data, 656 x 464, 8-bit/color RGB, non-interlaced


5

The EXIF handling tool exiv2 has a builtin option for this: exiv2 -T rename image.jpg sets the time of last file modification, mtime, to the date stored in the EXIF metadata. You asked for using the create time - but that is not used in Unix-like systems - and there are good reasons for that: Why doesn't *nix keep track of file creation time? I'm ...


5

Do not parse ls and the ls is not required here. Furthermore, you should quote your variables in case they contain spaces. for file in *.JPG; do convert -rotate 90 "$file" rotated_"$file" done



Only top voted, non community-wiki answers of a minimum length are eligible