Split image into large tiles?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mattyrb
Posts: 19
Joined: 2018-10-03T08:08:10-07:00
Authentication code: 1152

Split image into large tiles?

Post by mattyrb »

I'm using the following command on a 216 x 8880 image

magick convert frames.png -crop 216x120 tiles/tile%04d.png

Unfortunately it only outputs one image at 216x120.

Could someone tell me what I am doing wrong?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split image into large tiles?

Post by snibgo »

What version of IM, on what platfom?

If your platfom is Windows BAT, you need to double the %.
snibgo's IM pages: im.snibgo.com
mattyrb
Posts: 19
Joined: 2018-10-03T08:08:10-07:00
Authentication code: 1152

Re: Split image into large tiles?

Post by mattyrb »

version 7.0.8-68 x64. I'm literally running it at command prompt in Windows 10 but it only seems to produce 1 image and not do the entire image?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split image into large tiles?

Post by snibgo »

What is the name of the file it makes? What does identify say about it?
snibgo's IM pages: im.snibgo.com
mattyrb
Posts: 19
Joined: 2018-10-03T08:08:10-07:00
Authentication code: 1152

Re: Split image into large tiles?

Post by mattyrb »

The file created is tile000.png it's doing the first 216x120 piece of the image. I get the impression it's just not continuing down the file.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split image into large tiles?

Post by snibgo »

Your command works fine for me, using v7.0.8-64 on Windows 8.1.

I suggest you use "magick", not "magick convert". The usual Windows directory separator is backslash \ not forward-slash /. However, these make no difference for me.

What does identify say about your input frames.png? Please post the text output of "magick identify frames.png".

Try wriing to "info:" as the output filename:

Code: Select all

magick frames.png -crop 216x120 info:
Does the text output show one image, or many images?

How about a new input:

Code: Select all

magick -size 216x8880 xc: -crop 216x120 info:
snibgo's IM pages: im.snibgo.com
mattyrb
Posts: 19
Joined: 2018-10-03T08:08:10-07:00
Authentication code: 1152

Re: Split image into large tiles?

Post by mattyrb »

info: frames.png PNG 216x8880 216x120+0+0 8-bit sRGB 3.5611MiB 0.000u 0:00.000

magick frames.png -crop 216x120 tile%03d.png :info
magick: unable to open image 'tile%03d.png': No such file or directory @ error/blob.c/OpenBlob/3497.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split image into large tiles?

Post by snibgo »

mattyrb wrote:magick frames.png -crop 216x120 tile%03d.png :info
magick: unable to open image 'tile%03d.png': No such file or directory @ error/blob.c/OpenBlob/3497.
That command is garbage. Try the commands I showed you.
mattyrb wrote:info: frames.png PNG 216x8880 216x120+0+0 8-bit sRGB 3.5611MiB 0.000u 0:00.000
That's the problem. Your image is 216x8880 but on a virtual canvas of only 216x120 pixels. The cure is to "+repage" after reading the input:

Code: Select all

magick frames.png +repage -crop 216x120 tiles\tile%04d.png
snibgo's IM pages: im.snibgo.com
mattyrb
Posts: 19
Joined: 2018-10-03T08:08:10-07:00
Authentication code: 1152

Re: Split image into large tiles?

Post by mattyrb »

snibgo wrote: 2019-10-14T06:51:12-07:00
mattyrb wrote:magick frames.png -crop 216x120 tile%03d.png :info
magick: unable to open image 'tile%03d.png': No such file or directory @ error/blob.c/OpenBlob/3497.
That command is garbage. Try the commands I showed you.
mattyrb wrote:info: frames.png PNG 216x8880 216x120+0+0 8-bit sRGB 3.5611MiB 0.000u 0:00.000
That's the problem. Your image is 216x8880 but on a virtual canvas of only 216x120 pixels. The cure is to "+repage" after reading the input:

Code: Select all

magick frames.png +repage -crop 216x120 tiles\tile%04d.png
Works perfectly! Thank you so much for your help!
Post Reply