Page 1 of 1
Crop & Rotate
Posted: 2018-06-25T04:18:16-07:00
by QDeath
I would like to take an anterior.jpg and specify the upper left x,y coordinate and the height & width of the selection I want to include and then rotate the final image. Example: anterior.jpg is 1536 x 2048: the part of the pic that I want has 427,364 as the upper left coordinate and then the new image has a resulting size of 738 x 1158 and rotate 15 degrees clockwise and have final image as anterior-crop.jpg.
Looking to do this for 300,000 images. Currently I have a CSV file with example line: "427","364","1158","738","0","2048","1536","25432\anterior"
Re: Crop & Rotate
Posted: 2018-06-25T09:39:37-07:00
by fmw42
Re: Crop & Rotate
Posted: 2018-06-25T10:30:04-07:00
by QDeath
Sorry Windows!
I almost figured it out! Problem is I get the following error:
magick.exe: unable to open image '*-Modified.jpg': Invalid argument @ error/blob.c/OpenBlob/3457.
I want to save the new file with an appended as "-Modified.jpg" just not sure of the syntax. HELP!!
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1000Lateral-Initial.jpg" -crop 978x1335+418+309 -rotate 0 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1001Frontal-Initial.jpg" -crop 971x1266+545+168 -rotate -4 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1002Frontal Smile-Initial.jpg" -crop 919x1197+505+122 -rotate 0 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1005Right Occlusion-Initial.jpg" -crop 599x381+560+845 -rotate -3 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1006Anterior Occlusion-Initial.jpg" -crop 748x477+810+453 -rotate 0 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1007Left Occlusion-Initial.jpg" -crop 534x340+465+889 -rotate 0 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1013Panoramic-Initial.jpg" -crop 1141x498+-58+0 -rotate 0 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\11995\1001Frontal-Initial.jpg" -crop 626x736+331+53 -rotate 0 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1004Lower Occlusal-Initial.jpg" -crop 753x602+790+402 -rotate 0 *-Modified.jpg
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1399Composite-Initial.jpg" -crop 640x512+0+0 -rotate 0 *-Modified.jpg
Re: Crop & Rotate
Posted: 2018-06-25T10:54:06-07:00
by GeeMack
QDeath wrote: ↑2018-06-25T10:30:04-07:00I want to save the new file with an appended as "-Modified.jpg" just not sure of the syntax.
ImageMagick can hold the input file name as a variable to use as part of the output file name. Try something like this...
Code: Select all
magick input.jpg -set filename:f "%[t]-Modified" <do some other things here> "%[filename:f].jpg"
To use that in a BAT script you need to make the single percent signs "%" into doubles "%%".
Re: Crop & Rotate
Posted: 2018-06-25T10:59:35-07:00
by QDeath
File shows %[t]-modified.jpg
Re: Crop & Rotate
Posted: 2018-06-25T11:40:57-07:00
by QDeath
magick Anterior.jpg -set filename:f "%[t]-Modified" <do some other things here> "%[filename:f].jpg" -> This will crate Anterior-Modified.jpg?
Where are the docs for this?
Re: Crop & Rotate
Posted: 2018-06-25T11:58:56-07:00
by snibgo
Are you running this in a BAT file? If so, you must double the % to %%, as GeeMack says. See
http://www.imagemagick.org/Usage/windows/
Re: Crop & Rotate
Posted: 2018-06-25T12:05:34-07:00
by QDeath
Still error:
C:\Users\Friedman\Desktop\Images>C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\11995\1001Frontal-Initial.jpg" -set filename:f "%[t]-Modified" -crop 626x736+331+53 -rotate 0 "%[filename:f].jpg"
magick.exe: unable to open image '.\11995\1001Frontal-Initial.jpg': No such file or directory @ error/blob.c/OpenBlob/3457.
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1000Lateral-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 978x1335+418+309 -rotate 0 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1001Frontal-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 971x1266+545+168 -rotate -4 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1002Frontal Smile-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 919x1197+505+122 -rotate 3 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1005Right Occlusion-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 599x381+560+845 -rotate -3 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1006Anterior Occlusion-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 748x477+810+453 -rotate 0 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1007Left Occlusion-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 534x340+465+889 -rotate 0 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1013Panoramic-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 1141x498+-58+0 -rotate 0 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\11995\1001Frontal-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 626x736+331+53 -rotate 0 "%%[filename:f].jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1004Lower Occlusal-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 753x602+790+402 -rotate 0 "%%[t]-Modified.jpg"
C:\Progra~1\ImageMagick-7.0.8-Q16\magick.exe ".\19995\1399Composite-Initial.jpg" -set filename:f "%%[t]-Modified" -crop 640x512+0+0 -rotate 0 "%%[filename:f].jpg"
Re: Crop & Rotate
Posted: 2018-06-25T12:16:56-07:00
by QDeath
Oh no, my mistake. Thank you! Are there documentation on this type on input?
Re: Crop & Rotate
Posted: 2018-06-25T12:46:11-07:00
by fmw42