create new images by resizing the images in a folder
2 views (last 30 days)
Elysi Cochin on 30 Aug 2021
i have a folder of 7 images
i wanted to read each image one by one and create new images of different sizes, till i have 100 total images, including the initial 7 images
when i resize, the new images i create from a single image, should not have the same size, each image i create should have unique size
Walter Roberson on 30 Aug 2021
please can someone help me write the code in a simple way
Oddly enough, yesterday someone had the same need, and I described to them how to write the code in a simple way. However, they then deleted the question, so I cannot refer you to what that other person had already posted and my response to it.
Fortunately, the logs were complete enough that I was able to rescue a partial copy of what I wrote then:
"If you have only 7 images and you need a total of 100, does that mean that you want each image to be copied 14 times, plus another 2 images to make the total 100? If so then use copyfile() instead of imread() / imwrite()"
That is, the proper way to make copies of images is not to imread() / imwrite(): the proper way is to copyfile() the image. You can copyfile() to a different file name if you need to.