Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageMagick recipes #311

Closed
ablwr opened this issue Mar 28, 2018 · 7 comments
Closed

ImageMagick recipes #311

ablwr opened this issue Mar 28, 2018 · 7 comments
Assignees

Comments

@ablwr
Copy link
Member

ablwr commented Mar 28, 2018

As discussed in #310 and #309, we'd like to add an ImageMagick section to ffmprovisr, but we need recipes! Please share small scripts here!

@kfrn
Copy link
Member

kfrn commented Mar 28, 2018

Very basic, but these are ones I have used:

Resize specifying new width:
convert input -resize 750 output_750w.jpg
(this script will also convert the format, if the output has a different file extension than the input)

Create grid of images:
montage @list.txt -tile 6x12 -geometry +0+0 output_grid.jpg .
(list.txt is a list of filenames)

@JonnyTech
Copy link

JonnyTech commented Mar 28, 2018

I use the mogrify command for resizing:

mogrify -path ./resized/ -resize x1280 *.jpg

Specify either width, height or both - new files end up in the resized folder.

You can even use a percentage of the size in place of the number of pixels.

@JonnyTech
Copy link

Create thumbnails of images:

mogrify -resize 80x80 -format jpg -quality 75 -path thumbs *.jpg

Using convert command, but don't think it likes wildcards:

convert input.jpg -resize 80x80 -quality 75 thumbs/output.jpg

@JonnyTech
Copy link

Remove (strip) exif data, place new files in stripped folder:

mogrify -path ./stripped/ -strip *.jpg

@ablwr ablwr self-assigned this Mar 29, 2018
@nkrabben
Copy link

nkrabben commented Apr 2, 2018

Post any image surgery, it's nice to run compare, analogous to framemd5

compare -metric ae original.jpg new.jpg null:

Lots of different metrics available
https://www.imagemagick.org/script/command-line-options.php#metric
I use ae (I think that's default) but sometimes pae and psnr. For most metrics, we're looking for an output of 0.

It also creates an image of the differences between the two you're comparing, but I throw that away (null:)

@kieranjol
Copy link
Collaborator

I actually tried this using Graphicsmagick but it should work the same in IM:
convert -verbose input_file
Gives you a lot of nice metadata, but what's cool is the signature, which is kind of like a framesha256 for the image data, ignoring the metadata.

i was using grep to isolate the value:

convert -verbose input_file |grep -i
signature
 Signature: 3fb67059dca860c483b1deac912973b76d48fa9f0114d63e8116cff69d55bb4c

It was handy to verify an ffmpeg DPX patch (noone's replied to me yet and I'm expecting Carl Eugen to say this is all a terrible idea) https://patchwork.ffmpeg.org/patch/7598/

@ablwr
Copy link
Member Author

ablwr commented Jun 8, 2018

Added all the ones discussed above unless they were similar, so I am gonna close this issue. But more recipes are very welcome and can be added in the traditional ways (making an issue or a PR). Thanks everybody who contributed!

@ablwr ablwr closed this as completed Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants