Hello
Say you have a bunch of files in a folder and you want to do some "-evaluate-sequence mean" on them. Right now it will fail if the pictures in the list are different. The inspiration comes from http://blog.patdavid.net/2013/09/mean-a ... ideos.html
What I want is to have IM resize the pictures before doing the -evaluate stuff.
Is that possible? It doesn't matter if the solution is in windows or linux format
It's all part of a larger plan to have some sort of script/program that will take an argument (from the -evaluate-sequence possibilities), resize the images to the largest size (the current problem), then do the log/mean/median/cos/etc function on the pictures (perhaps via xargs so I don't run into over use of ram problems)
Example workflow:
$ IMProgramName log 50
1) resize all pictures in list (via ls or similar)
2) Create log folder in current folder
3) ls resizedPictures*.jpg | xargs 50 pictures at a time (where 50 comes from the argument of IMProgramName)
4) convert "$0" "$@" -evaluate-sequence log log/"$0" (where "log" comes from the argument of IMProgramName)
5) exit
Does that make sense or have I been smoking some funny tennis shoes too much? (And I'm not expecting a full program/script/thing for the larger plan, btw!)
Best regards
Mads Johansen
Resize all pictures in list to largest size in list
-
- Posts: 2
- Joined: 2014-07-27T23:48:51-07:00
- Authentication code: 6789
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resize all pictures in list to largest size in list
The basic IM command would be:
This resizes all images to exactly 300x200 before finding the mean.
How do you find the required size? A script might loop through them all, using "identify" on each. Or ...
... will tell you the maximum width and maximum height.
Code: Select all
convert a.png b.png c.png d.png -resize 300x200! -evaluate-sequence Mean out.png
How do you find the required size? A script might loop through them all, using "identify" on each. Or ...
Code: Select all
convert a.png b.png c.png d.png -layers Mosaic info:
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Resize all pictures in list to largest size in list
Or you can just 'flatten' all the images together. The final image size will be the area that contains all the images.
Note that may be larger than the largest image size as you may have a wide image and long image!
Note that may be larger than the largest image size as you may have a wide image and long image!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 2
- Joined: 2014-07-27T23:48:51-07:00
- Authentication code: 6789
Re: Resize all pictures in list to largest size in list
Like 'convert *.jpg -flatten out.jpg' ? It's only the size of the first imageanthony wrote:Or you can just 'flatten' all the images together. The final image size will be the area that contains all the images.
Note that may be larger than the largest image size as you may have a wide image and long image!
Code: Select all
convert *.jpg -layers Mosaic info:
The way I have found to solve this problem so far is to do
Code: Select all
$ ls image*.jpg | xargs -n 100 sh -c 'convert "$0" "$@" -layers Mosaic info: '
- image0001.jpg JPEG 1000x1823 1000x1823+0+0 8-bit DirectClass 1.969u 0:00.639
image0101.jpg JPEG 1000x1818 1000x1818+0+0 8-bit DirectClass 2.719u 0:00.668
image0201.jpg JPEG 1000x2000 1000x2000+0+0 8-bit DirectClass 2.250u 0:00.617
image0301.jpg JPEG 1000x1862 1000x1862+0+0 8-bit DirectClass 1.594u 0:00.568
image0401.jpg JPEG 1000x2000 1000x2000+0+0 8-bit DirectClass 2.562u 0:00.666
image0501.jpg JPEG 1000x1507 1000x1507+0+0 8-bit DirectClass 1.829u 0:00.569
image0601.jpg JPEG 1000x1725 1000x1725+0+0 8-bit DirectClass 2.031u 0:00.583
image0701.jpg JPEG 1000x1920 1000x1920+0+0 8-bit DirectClass 2.234u 0:00.620
image0801.jpg JPEG 1000x1920 1000x1920+0+0 8-bit DirectClass 1.312u 0:00.512
image0901.jpg JPEG 1000x1564 1000x1564+0+0 8-bit DirectClass 2.031u 0:00.575
image1001.jpg JPEG 1000x1817 1000x1817+0+0 8-bit DirectClass 1.484u 0:00.574
image1101.jpg JPEG 1000x1589 1000x1589+0+0 8-bit DirectClass 1.781u 0:00.616
image1201.jpg JPEG 1067x1600 1067x1600+0+0 8-bit DirectClass 0.188u 0:00.088
Re: Resize all pictures in list to largest size in list
I believe -ping does not load the image and you could use an fx expression to get the size.
You would probably need to write some code to loop through the images with convert and save the data.
You would probably need to write some code to loop through the images with convert and save the data.