Conditional Resizing
-
- Posts: 24
- Joined: 2013-07-14T03:36:12-07:00
- Authentication code: 6789
Conditional Resizing
hi
I am facing problem in this, As I have multiple images to work on but do not want to review there canvases and Sizes
can any one help me out on this,
For Example
if Image is between 475x475 then set canvas as 500x500 with gravity center,
if image size is between 135x135 to 159x159 set gravity center and canvas as 160x160
but do nothing if image size is between 161X161 to 199x199,
and
if image size between 200x200 to 224x224 set gravity center and set canvas as 225x225
but do nothing if image is between 226x226 to 274x274
if image size is between 275x275 to 299x299 set gravity center and canvas as 300x300
but do nothing if image size is between 301X301 to 475x475,
kindly help me out on this,
I am facing problem in this, As I have multiple images to work on but do not want to review there canvases and Sizes
can any one help me out on this,
For Example
if Image is between 475x475 then set canvas as 500x500 with gravity center,
if image size is between 135x135 to 159x159 set gravity center and canvas as 160x160
but do nothing if image size is between 161X161 to 199x199,
and
if image size between 200x200 to 224x224 set gravity center and set canvas as 225x225
but do nothing if image is between 226x226 to 274x274
if image size is between 275x275 to 299x299 set gravity center and canvas as 300x300
but do nothing if image size is between 301X301 to 475x475,
kindly help me out on this,
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Conditional Resizing
You probably need to write a script. This would read the image size, and set the new size as needed (although I'm not quite sure what you are trying to do).
What is your platform: Windows, Unix, Mac or other?
What is your platform: Windows, Unix, Mac or other?
snibgo's IM pages: im.snibgo.com
-
- Posts: 24
- Joined: 2013-07-14T03:36:12-07:00
- Authentication code: 6789
Re: Conditional Resizing
I am using linux ubuntu, I understand that I need to write an script but I have told that whatever I need to know how to set canvases in conditional resizing
if Image's size between 475x475 then set canvas as 500x500 with gravity center,
if image size is between 135x135 to 159x159 set gravity center and canvas as 160x160
but do nothing if image size is between 161X161 to 199x199,
and
if image size between 200x200 to 224x224 set gravity center and set canvas as 225x225
but do nothing if image is between 226x226 to 274x274
if image size is between 275x275 to 299x299 set gravity center and canvas as 300x300
but do nothing if image size is between 301X301 to 475x475,
I think I have described what I am looking for,
if anyone can write an script I would be thankful...
if Image's size between 475x475 then set canvas as 500x500 with gravity center,
if image size is between 135x135 to 159x159 set gravity center and canvas as 160x160
but do nothing if image size is between 161X161 to 199x199,
and
if image size between 200x200 to 224x224 set gravity center and set canvas as 225x225
but do nothing if image is between 226x226 to 274x274
if image size is between 275x275 to 299x299 set gravity center and canvas as 300x300
but do nothing if image size is between 301X301 to 475x475,
I think I have described what I am looking for,
if anyone can write an script I would be thankful...
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Conditional Resizing
I don't use Unix so can't help you with the script.
snibgo's IM pages: im.snibgo.com
Re: Conditional Resizing
For the 500x500 canvas you would need to use extent:
Just use the same imagemagick code for each of your sizes and just change the -extent values.
Code: Select all
convert input_image -backround white -gravity center -extent 500x500 output_image
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Conditional Resizing
Do you want the images resized (resampled), or are you wanting a border added? A colored border, or a transparent one? Are your initial images always square?
This could be done using only IM, but a script may be easier and more readable.
This could be done using only IM, but a script may be easier and more readable.
-
- Posts: 24
- Joined: 2013-07-14T03:36:12-07:00
- Authentication code: 6789
Re: Conditional Resizing
Thanks for Asking Green,
Actually I dont wanna add border or color or any thing like them but I want to just resize canvas and said conditions
Actually I dont wanna add border or color or any thing like them but I want to just resize canvas and said conditions
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Conditional Resizing
I think Bonzo read your post as asking to place an image on a larger background canvas, which is understandable since you spoke of a canvas and gravity. If this is what you want, your canvas would need a color. If you do not want a background canvas, what do you mean by gravity?
Again, are your initial images always square?
You are asking for a complex conditional resize. Do you have a command working for one image you could give as an example of what you want?
Again, are your initial images always square?
You are asking for a complex conditional resize. Do you have a command working for one image you could give as an example of what you want?
-
- Posts: 24
- Joined: 2013-07-14T03:36:12-07:00
- Authentication code: 6789
Re: Conditional Resizing
/home/$whoamI/Desktop/Images/Originals/
mogrify -path /home/$whoamI/Desktop/Images/converted/ -trim -gravity center -resize 300x300 -extent 300x300 *.jpg
I do not have images in square, but in different Dimensions, For Example 480x320 or 2375x2500
I want to resize images As per conditions given by me,
mogrify -path /home/$whoamI/Desktop/Images/converted/ -trim -gravity center -resize 300x300 -extent 300x300 *.jpg
I do not have images in square, but in different Dimensions, For Example 480x320 or 2375x2500
I want to resize images As per conditions given by me,
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Conditional Resizing
Okay, that is a start. To use your example, you begin with a 2375x2500 image. I do not understand which conditional case it falls under? I do not understand what exactly you want done?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Conditional Resizing
Confusingly, two threads have been started on this topic, under "Users" and "Developers".
Can a moderator merge them?
Can a moderator merge them?
snibgo's IM pages: im.snibgo.com
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Conditional Resizing
This entire thread can be deleted. All of the useful information is in this thread in the Developers forum.
-
- Posts: 24
- Joined: 2013-07-14T03:36:12-07:00
- Authentication code: 6789
how to remove its shadow and get trimmed and sized
hi there
can any one tell me what should be done if I want to use this image and remove its shadow background is white then trim it edge to edge then resize it with size either X or Y (whichever is larger )
I am using linux ubunto
I want to apply this to whole directory
there is nothing except images in this directory
can any one tell me what should be done if I want to use this image and remove its shadow background is white then trim it edge to edge then resize it with size either X or Y (whichever is larger )
I am using linux ubunto
I want to apply this to whole directory
there is nothing except images in this directory
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Conditional Resizing
This isn't about Conditional Resizing, so start a new thread. And supply an example image.
snibgo's IM pages: im.snibgo.com