Trimming Transparent Spaces in Bulk
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Trimming Transparent Spaces in Bulk
i have a series of images that i need to work on getting into GIF formate and be under 10 seconds and 10 MB
There are roughly 700 images in the sequence.
The current Gif is working but its 50 MB
I want to start by dropping the quality down to 720 instead of 1080
Then From there i want to Crop out the wasted space
But there are a lot of images so how can i do this in a batch.
I would be willing to do multiple runs trimming one side at a time if i need to.
You guys are way better at this than i am. Any help would be great
There are roughly 700 images in the sequence.
The current Gif is working but its 50 MB
I want to start by dropping the quality down to 720 instead of 1080
Then From there i want to Crop out the wasted space
But there are a lot of images so how can i do this in a batch.
I would be willing to do multiple runs trimming one side at a time if i need to.
You guys are way better at this than i am. Any help would be great
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Trimming Transparent Spaces in Bulk
Is the wasted space where you have drawn zig-zag lines? What about the horizontal and vertical lines? Did you draw them or were they in the image?
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images,
See viewtopic.php?f=1&t=9620
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images,
See viewtopic.php?f=1&t=9620
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
Ah yeah sorry.fmw42 wrote:Is the wasted space where you have drawn zig-zag lines? What about the horizontal and vertical lines? Did you draw them or were they in the image?
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images,
See viewtopic.php?f=1&t=9620
Windows 10
And yeah.. everything inside the red box is the area i want to keep. I drew all the red lines.
and i dont really have a command for this yet. Thats more or less what im looking at how to make is the command
to batrch crop these
Last edited by BajungaDustin on 2016-06-30T16:56:53-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Trimming Transparent Spaces in Bulk
Does "-trim" do what you want? Possibly with "-fuzz XX%" before the trim?
snibgo's IM pages: im.snibgo.com
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
Im not sure... i think that trim is possibly what im looking for but im not sure how to use it.snibgo wrote:Does "-trim" do what you want? Possibly with "-fuzz XX%" before the trim?
And im not sure about fuzz.. i used that to get rid of the green. (this image is really just a reference because its the exact same positioning ive already got rid of the green... There is just now a lot of wasted space on the left side of the image..
like.. its a 1080p gif that doesnt need to be with about 70% of each image that basically just needs to go
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
Basically i want to go from This
to this
and before i do that i need to resize all the images to 1280x720 instead of 1920x1080
to this
and before i do that i need to resize all the images to 1280x720 instead of 1920x1080
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Trimming Transparent Spaces in Bulk
try this
You will have to play with XX. Start low and increase it.
Just make XX as small as possible that gets rid of the background color, so that you do not lose part of your figure. But XX may need to be significant (30% or so) since you likely will have some antialiasing (mixing of the background color with the edges of your figure) so that you need a large XX since the background color will not be a constant. If the background color is a constant then XX can be 0 or a few percent if you have saved the image as JPG, which may change colors due to the lossy compression in blocks.
Code: Select all
convert image -fuzz XX% -trim +repage result
Just make XX as small as possible that gets rid of the background color, so that you do not lose part of your figure. But XX may need to be significant (30% or so) since you likely will have some antialiasing (mixing of the background color with the edges of your figure) so that you need a large XX since the background color will not be a constant. If the background color is a constant then XX can be 0 or a few percent if you have saved the image as JPG, which may change colors due to the lossy compression in blocks.
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
fmw42 wrote:try this
You will have to play with XX. Start low and increase it.Code: Select all
convert image -fuzz XX% -trim +repage result
Just make XX as small as possible that gets rid of the background color, so that you do not lose part of your figure. But XX may need to be significant (30% or so) since you likely will have some antialiasing (mixing of the background color with the edges of your figure) so that you need a large XX since the background color will not be a constant. If the background color is a constant then XX can be 0 or a few percent if you have saved the image as JPG, which may change colors due to the lossy compression in blocks.
I guess i may have misslead you.. my background is already transparent. The file size is just too big in its current state.
Im not trying to get rid of the background color. I just need to make the images smaller because nothing happens on the left side of the page.. i need to "trim off some of the transparent wasted space"..
The character goes from standing.. to kneeling.. to standing again.. nothing else.
So all the space around him is just making the GIF bigger than it needs to be
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
This is what i have so far.. and as you can see there is a lot of room to crop this out and make it smaller.
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
ok i got the resize done
that worked like a charm.
I also tried Mogrify -Trim on a test image and it trimmed perfectly like i wanted.. but it was too close to the character model and the animations will be cut off. also.. the trim trims around the object it sees and removes the unused area of the images.. so this wont work as the image will change each frame thus giving me 700 images each with different sizes
so cropping the image without using anything that is content aware has to be the way to go
Code: Select all
>Mogrify -resize 1280x720 00*.png
I also tried Mogrify -Trim on a test image and it trimmed perfectly like i wanted.. but it was too close to the character model and the animations will be cut off. also.. the trim trims around the object it sees and removes the unused area of the images.. so this wont work as the image will change each frame thus giving me 700 images each with different sizes
so cropping the image without using anything that is content aware has to be the way to go
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Trimming Transparent Spaces in Bulk
Is this for an animated GIF? Or for one GIF per image? If it's for animated GIF, don't trim each individual frame, because then the animation will jump around. Instead, use "-layers optimize" on the overall GIF.
snibgo's IM pages: im.snibgo.com
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
snibgo wrote:Is this for an animated GIF? Or for one GIF per image? If it's for animated GIF, don't trim each individual frame, because then the animation will jump around. Instead, use "-layers optimize" on the overall GIF.
Yeah one Gif... and you are correct.. i kinda worked that out in me head when i tested a mogrify -trim... the image would definately jump around.
but im not sure what tou mean by layer optimize.. on the overall gif.. what exactly will that do.
and.. the gif comes out kinda crappy rright now because its sooo big. i almost think i need to trim it down before it goes into the gif because its realy sluggish... the above gif is a little too fast and its only half of the frames (the odd frames only)
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
the layers optimize made it all kinds of jacked up.. leaving image ghosts but only like every 2 seconds or so.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Trimming Transparent Spaces in Bulk
Let's start again. What version of IM are you using? "convert -version" will tell you. You are on Windows 10, that's fine.
You have a load of stills, and want an animated GIF. Is that correct? If the stills contain a constant background, that won't take much filespace.
You said:
You have a load of stills, and want an animated GIF. Is that correct? If the stills contain a constant background, that won't take much filespace.
You said:
What command did you use?The current Gif is working but its 50 MB
snibgo's IM pages: im.snibgo.com
-
- Posts: 15
- Joined: 2016-06-29T11:40:12-07:00
- Authentication code: 1151
Re: Trimming Transparent Spaces in Bulk
Something like...snibgo wrote:Let's start again. What version of IM are you using? "convert -version" will tell you. You are on Windows 10, that's fine.
You have a load of stills, and want an animated GIF. Is that correct? If the stills contain a constant background, that won't take much filespace.
You said:What command did you use?The current Gif is working but its 50 MB
Code: Select all
"convert -delay 1.5 -loop 1 00*.png animated.gif"
Which was using
Code: Select all
Convert 00*.png -crop 400x640+750+-40 +Repage Cropped.png
Last edited by BajungaDustin on 2016-06-30T18:17:59-07:00, edited 1 time in total.