Page 1 of 2

Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T09:31:30-07:00
by celvenjohnson33
I am having trouble getting Imagemagick to do this. This is what I have so far. I need to select any file that has *.jpg and randomly rotate and shear the images within 10 degrees.

Help

magick /Users/Username/Desktop/folder/*.jpg ShearRotateImage(const Image *jpg,"%[fx:-1+2*rand()]")

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:02:29-07:00
by fmw42
Your syntax is bad. You are mixing command line and API code. Also you cannot use wild cards for both input an output. You should use magick mogrify to process a folder of images. But mogrify is old technology and does not allow inline computations. So you will likely need to write a script loop over each image and process them that way. Then you can do

Code: Select all

magick image.jpg -alpha on -background none -shear "%[fx:10*(-1+2*rand())]x0" image.png
see https://imagemagick.org/script/command- ... .php#shear


____________________

Please, always provide your IM version and platform when asking questions, since syntax may differ.


If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:36:56-07:00
by celvenjohnson33
magick /Users/username/Desktop/MM10918\ copy /image.jpg -alpha on -background none -shear "%[fx:10*(-1+2*rand())]x0" image.jpg
magick: no decode delegate for this image format `' @ error/constitute.c/ReadImage/556.


I keep getting this error?

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:37:36-07:00
by fmw42
What is your IM version and Platform/OS? If a Unix system, I can help with the script loop. If on Windows, then someone else would have to help.

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:39:40-07:00
by fmw42
Filenames with spaces need to be put in double quotes. You are also mixing \ and /. For Unix, only use /

Code: Select all

magick "/Users/username/Desktop/MM10918/ copy /image.jpg" -alpha on -background none -shear "%[fx:10*(-1+2*rand())]x0" image.jpg
Or do I misunderstand your \ copy /

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:41:22-07:00
by celvenjohnson33
I am using V7 on High Sierra. Yes there are spaces in the file names

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:48:40-07:00
by celvenjohnson33
magick "/Users/celvenjohnson27\ 1/Desktop/MM10918\ copy/image.jpg" -alpha on -background none -shear "%[fx:10*(-1+2*rand())]x0" image.jpg

Im using this but getting the same error directory @ error/blob.c/OpenBlob/348

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:54:01-07:00
by celvenjohnson33
Does this apply to all the .jpg files in the folder?

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T10:54:24-07:00
by celvenjohnson33
Does this apply to all the .jpg files in the folder?

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T11:06:29-07:00
by celvenjohnson33
unable to open image . this is the error Im getting

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T11:18:36-07:00
by celvenjohnson33
I got the path to work, Im not sure it is working though? They do not look rotated or sheared?

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T11:29:07-07:00
by celvenjohnson33
Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-09-23
Using Mac

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T12:36:02-07:00
by fmw42
Cd to the directory where you have your input and try it there

Code: Select all

magick image.jpg -alpha on -background none -shear "%[fx:10*(-1+2*rand())]x0" image.png
Does that work?

What exact version of IM 7?

Code: Select all

magick -version
If you file path actually has \ then use your actual file path but put double quotes about it. But are you sure about the path? Why do you want spaces. That just makes it more confusing. I do not advise doing that. But it should work if you have the correct path and use quotes.

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T12:45:49-07:00
by celvenjohnson33
Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-09-23

Re: Need to randomley ShearRotateImage in Folder

Posted: 2018-10-10T12:56:03-07:00
by celvenjohnson33
this is the error I get now after i cd the directory

magick: unable to open image 'image.jpg': No such file or directory @ error/blob.c/OpenBlob/3489.

the files are formatted as "yyyy-mm-dd-hh-mm-ss.jpg"