Hi All,
I have a pic that is 4800X4800 , how can I split it to 100X200 images ? can I do this Automatically?
Math
split image to 100X200 form 4800
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: split image to 100X200 form 4800
Code: Select all
convert pic.png -crop 100x200 +repage x-%03d.png
snibgo's IM pages: im.snibgo.com
Re: split image to 100X200 form 4800
yes this is the magic .... work great !!!!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: split image to 100X200 form 4800
Good stuff.
Sadly, I can't count. You should get 48*24 = 1152 files, which needs 4 digits, so it is better to put %04d in the output file name. "%03d" will work, but most of the files will have 3 digits, with just the final 153 having 4 digits.
Sadly, I can't count. You should get 48*24 = 1152 files, which needs 4 digits, so it is better to put %04d in the output file name. "%03d" will work, but most of the files will have 3 digits, with just the final 153 having 4 digits.
snibgo's IM pages: im.snibgo.com
Re: split image to 100X200 form 4800
Be aware that the resulting images will all contain PNG vpAg and oFFs chunks to record the size of the canvas and the location of the image on the canvas. If you don't want those, use the "-repage" or "-strip" option.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: split image to 100X200 form 4800
"-repage"? I thought it was "+repage", as I used above?
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: split image to 100X200 form 4800
-repage 0x0+0+0 or +repage
This resets canvas size (to image size) and the canvas offset.
I don't believe strip removes virtual canvas offsets.
As an alternative you can use
-crop @48x24
specifying the number of images wanted instead of size.
See Cropping into roughly Equally Sized Divisions
http://www.imagemagick.org/Usage/crop/#crop_equal
This resets canvas size (to image size) and the canvas offset.
I don't believe strip removes virtual canvas offsets.
As an alternative you can use
-crop @48x24
specifying the number of images wanted instead of size.
See Cropping into roughly Equally Sized Divisions
http://www.imagemagick.org/Usage/crop/#crop_equal
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: split image to 100X200 form 4800
Oops. Yes, +repage (or as Anthony says, "-repage 0x0+0+0").snibgo wrote:"-repage"? I thought it was "+repage", as I used above?
And yes, the page info in PNG vpAg and oFFs chunks does survive
the -strip operation. That's a recent change that I was not aware of; IM-6.8.5-0
strips them, while IM-6.8.5-2 preserves them. I guess that has to do with the recent
reorganization of properties and attributes.
edit: this seems to be fixed in 6.8.5-4.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: split image to 100X200 form 4800
No -strip actually does remove those profiles, but the profile data is heavily used, so gets stored as image attributes.
(definition: an image attribute is a property stored as actual values rather than as a string)
But the coder recreates them based on the image attributes (not profile info).
Just as it sets those image attributes from the profile info, as the image is read in.
As such the canvas meta-data by passes -strip, and that is a good thing.
-strip is meant to remove extra or extraneous profiles that images do not actually need.
(definition: an image attribute is a property stored as actual values rather than as a string)
But the coder recreates them based on the image attributes (not profile info).
Just as it sets those image attributes from the profile info, as the image is read in.
As such the canvas meta-data by passes -strip, and that is a good thing.
-strip is meant to remove extra or extraneous profiles that images do not actually need.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/