Page 1 of 1

Cut big images in small ones for sprites

Posted: 2016-12-09T22:39:36-07:00
by Dark Side
ren *.bmp *.bm2
mogrify -flop *.bm2
mogrify -rotate 270 *.bm2
mogrify.exe -format %02d.bmp -crop 32x32 *.bm2
del *.bm2 (optional)
mogrify -rotate 90 *.bmp
mogrify -flop *.bmp
montage -geometry +0+0 -tile 100x1 *.bmp out.bmp


I have problems doing this in a batch file, because in this command

mogrify.exe -format %02d.bmp -crop 32x32 *.bm2

The % simbol not work in batch file, if someone can fix this problem


Estou tentando seguir esse primeiro exemplo desse site abaixo e o texto acima foi tirado de outro site!nem no pronpt eu acertei fazer a linha 4

http://www.theelf-megadev.com/tut1d.htm

Sorry i am ultranoob!!! :lol:

as imagens estão no C:\imagens

Re: Cut big images in small ones for sprites

Posted: 2016-12-09T22:49:16-07:00
by fmw42
I do not think mogrify allow -format to have anything but the suffix such as -format bmp. -format tells mogrify what format to use for output. Mogrify only processes one output per input. So you cannot get images such a from a multiple crop.

So you need to write a script loop over each image and use convert to process it into multiple output images from your crop command.

Re: Cut big images in small ones for sprites

Posted: 2016-12-10T07:17:50-07:00
by snibgo
In a Windows BAT fle, % signs that are not for environment variables must be doubled.

Re: Cut big images in small ones for sprites

Posted: 2016-12-10T17:07:27-07:00
by Dark Side
fmw42 wrote:I do not think mogrify allow -format to have anything but the suffix such as -format bmp. -format tells mogrify what format to use for output. Mogrify only processes one output per input. So you cannot get images such a from a multiple crop.

So you need to write a script loop over each image and use convert to process it into multiple output images from your crop command.
Voçe poderia testar e corrigir?

Test and fix? i am noob

Re: Cut big images in small ones for sprites

Posted: 2016-12-10T19:26:17-07:00
by fmw42
I tested and it does not work. I do not believe it can be fixed. It is not a bug. It is just the way mogrify works.

Re: Cut big images in small ones for sprites

Posted: 2016-12-11T09:42:18-07:00
by Dark Side
fmw42 wrote:I tested and it does not work. I do not believe it can be fixed. It is not a bug. It is just the way mogrify works.

http://www.imagemagick.org/Usage/crop/#crop_tile


Eu acho que encontrei a solução.Olha esse exemplo! Vou ver se acerto!

Re: Cut big images in small ones for sprites

Posted: 2016-12-11T11:46:57-07:00
by Dark Side
Dark Side wrote:
fmw42 wrote:I tested and it does not work. I do not believe it can be fixed. It is not a bug. It is just the way mogrify works.

http://www.imagemagick.org/Usage/crop/#crop_tile


Eu acho que encontrei a solução.Olha esse exemplo! Vou ver se acerto!
@echo off

ren *.bmp *.bm2
mogrify -flop *.bm2
mogrify -rotate 270 *.bm2

ren *.bm2 *.bmp <-----------------
convert *.bmp -crop 32x32 %02d.bmp <-----------------

mogrify -rotate 90 *.bmp
mogrify -flop *.bmp
montage -geometry +0+0 -tile 100x1 *.bmp out.bmp <------------- Falta corrigir esse calculo.A imagem do Earthquake junta sai diferente do site!




cmd