I am reading, cropping, and writing bulk DSLR jpg images in Matlab using imread, imcrop, and imwrite in a loop but have two questions:
-I want to retain the original pixel value information so I am using lossless mode during writing but I noticed that the resultant file size is ~6x the original image size even though the image is cropped to ~half the total original pixel count. Similarly, lossy export with 100% quality and half the number of pixels is ~2x the original image size. I can understand how saving subsequent lossy jpg files can compress information AND file size but it doesn't appear to be working this way. Maybe the compression/file writing scheme of Matlab and the original file differ? If so, maybe there is a file exchange that would allow for this scheme to be detected and remain consistent through repeated file exports?
-I am trying to speed up the batch export process using the 3 simple looped commands that are stated above. I think that if I can reduce the resultant lossless file size from my first point then I will speed up the biggest bottleneck which is writing the increased file size to desk. But maybe you have a more clever way to open and save a larger amount of images (~20k)? I do see other open-source software available for bulk image resizing but not necessarily bulk image cropping.