Cut big images in small ones for sprites

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Dark Side
Posts: 4
Joined: 2016-12-09T22:11:15-07:00
Authentication code: 1151

Cut big images in small ones for sprites

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cut big images in small ones for sprites

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Cut big images in small ones for sprites

Post by snibgo »

In a Windows BAT fle, % signs that are not for environment variables must be doubled.
snibgo's IM pages: im.snibgo.com
Dark Side
Posts: 4
Joined: 2016-12-09T22:11:15-07:00
Authentication code: 1151

Re: Cut big images in small ones for sprites

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cut big images in small ones for sprites

Post 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.
Dark Side
Posts: 4
Joined: 2016-12-09T22:11:15-07:00
Authentication code: 1151

Re: Cut big images in small ones for sprites

Post 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!
Dark Side
Posts: 4
Joined: 2016-12-09T22:11:15-07:00
Authentication code: 1151

Re: Cut big images in small ones for sprites

Post 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
Post Reply