Page 2 of 2

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-02-27T23:05:19-07:00
by Rye
If I type:

"c:\program files\imageMagick-6.8.3-Q16\identify" -version


It outputs:

Versin: ImageMagick 6.8.3-6 2013-02-26 Q16 http://www.imagemagick.org
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jp2 jpeg lcms lzma pango png ps tiff x xml zlib

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-02-28T03:59:28-07:00
by snibgo
That directory can be added to your path, so programs there will be found without having to give their location every time. Type:

Code: Select all

set PATH=c:\program files\imageMagick-6.8.3-Q16\;%PATH%
This adds the directory to the path for this command window only. Try the commands and script now.

To make the change system-wide: Control panel, System, Advanced, Evironment variables, System variables. Or you can reinstall IM and let it do the job for you.

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-02-28T13:12:22-07:00
by Rye
Ok, after reinstalling it seems to work now.

Is there a way to have that batch script process multiple files at a time ? E.g. all gifs in one folder and output them to another folder, numbered 001 002 etc. ?

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-02-28T13:23:51-07:00
by snibgo
Yes. See any guide on scripting in Windows.

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-02-28T14:03:48-07:00
by Rye
[deleted]

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-01T03:13:34-07:00
by Rye
EDIT: There is a really simple way that all those images have in common:

Their pattern repeats after EXACTLY 128x128 pixels.

Could you please change your script to work for those files only ? That would reslove this problem and this thread could be closed.

Thanks for all you assistance. It was of great help to me !

:D

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-03T06:59:43-07:00
by Rye
I know got this one working:

Code: Select all

SET /P width=Please enter canvas width:
SET /P heigth=Please enter canvas heigth:
convert *.gif -crop 128x128+0+0 cropped.png

"%IMG%convert" ^
  -size %width%x%heigth% ^
  tile:cropped.png ^
  tiled.png
However the problem is that I want this script to process 100+ gifs inside the same folder.

If I currently put it in the folder it will only output some croped-X.png's and quit.

It should be able to process each gif after the other.

Ideas ?

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-03T11:40:44-07:00
by fmw42
convert *.gif -crop 128x128+0+0 cropped.png
With PNG you need to remove the virtual canvas by adding +repage after the crop.

Furthermore you process all the gifs as cropped-xxx.png, but you only use cropped.png in your next command.

I do not believe that you are looping correctly or I do not understand what you are trying to do. Sorry I am not a Windows user, so cannot help much more at this point without further explanation.

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-03T12:12:06-07:00
by Rye
I only need 1 cropped.png for the output file.
1 cropped.png -> tiled.png

Well that script aside:

The only thing I try is:

Process input file (001)
- save to outputfile that matches the 001 of the input and add a -output to it

Repeat with 002...

You could say "lets not care about the script at all right now" the only thing that matters is to find a way to process all gifs in the folder and then afterwards have the output correlate to the same number.


Wait a minute now thats an idea... when I processed all those images to lets say... cropped-0.png, cropped-1.png ...

What would I have to do then in order to get the rest working ?

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-03T12:33:53-07:00
by snibgo
"convert *.gif" will read all the gifs before processing any of them. Maybe not a great idea.

For looping through files, see Windows "for" command. You could have two converts within the for-loop: one to crop, the second to tile. (Or even do both jobs in one convert.)

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-04T10:41:00-07:00
by Rye
After some fiddling around I got this far:

Code: Select all

for %%X in (*.png) do "%IMG%convert" ^
-size 612x322 ^
tile:%%X ^
tiled.jpg
The problem now however is that I only have one tiled jpg.
How can I achieve that the tiled will be automatically numbered so I have it like this: 001tiled.jpg 002tiled.jpg..... ?

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-04T12:29:47-07:00
by snibgo
That would be quite tricky. But you can easily do:

Code: Select all

for %%X in (*.png) do "%IMG%convert" ^
-size 612x322 ^
tile:%%X ^
%%~nX_tiled.jpg
Type "for /?" or "help for" for this and other options.

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-04T13:54:31-07:00
by Rye
ok, that works great !

Re: Stitching image on given canvas size using ImageMagic ?

Posted: 2013-03-08T05:32:35-07:00
by Rye
Since this problem is resolved the thread can be closed !

Thank you very much again for your extensive and effective help !