Image resize that adds black borders
Posted: Fri Jan 24, 2014 10:09 am
Hi,
I am attempting to create a utility that processes an image and reduces the image to a fixed size. For example my images are taken on a 4/3rds camera and I would like to produce thumb nails that are 80 by 60 pixels in size.
I have code that rescales my images but some of the originals have been cropped e.g to a square format so when the thumb nail is created it is 60 by 60 pixels in size. My question is how do I add black borders to my thumb nail so that the result is an image that measures 80 by 60 pixels i.e. the thumb nail with black pixels 10 by 60 added to each side? I have tried to use the crop function but have not been able to get it to work. I have also looked at Chris Bodel's photoroom stack but the copy I found does not have the resize and crop functions implemented.
Any ideas?
I am attempting to create a utility that processes an image and reduces the image to a fixed size. For example my images are taken on a 4/3rds camera and I would like to produce thumb nails that are 80 by 60 pixels in size.
I have code that rescales my images but some of the originals have been cropped e.g to a square format so when the thumb nail is created it is 60 by 60 pixels in size. My question is how do I add black borders to my thumb nail so that the result is an image that measures 80 by 60 pixels i.e. the thumb nail with black pixels 10 by 60 added to each side? I have tried to use the crop function but have not been able to get it to work. I have also looked at Chris Bodel's photoroom stack but the copy I found does not have the resize and crop functions implemented.
Any ideas?