Cropping non-JPG/PNG files

Hello,

I am working on setting up cropping via a UploadCare widget and have questions about filetypes. I see in some stack overflow answers from 2016 that only JPG and PNG can be previewed and cropped, and am wondering if that is still the case?

I also see that files can be converted to various formats via the REST API, and wonder if it would be possible to upload a file like a PDF or PSD, convert it to a JPG, and then crop the JPG.

Any feedback is appreciated,
thanks,
Alex

Hi Alex, our image processing allows you to transform images of most of the popular raster formats. You can find a full list of supported formats here (see “Fully supported formats”)

https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#fully-supported-formats

PSD images can’t be processed, and our backend doesn’t recognize them as image files. It’s possible to convert a PSD file to a JPG or PNG using our document conversion API and then process the output image. Note that document conversion is not real-time, and depending on the input file, the conversion operation may take a few minutes or even more. Could you explain the workflow you’re looking to build in more detail?

Hello,

Thanks for the info. The workflow is to allow customers to upload images for fine art printing. If they can crop the image in the upload flow, the printing technicians will not have to follow up on orders to ascertain how they want the image cropped if they supply a source image that does not match the exact ration that they order. It is already working for JPG and PNG, I am just trying to ascertain the ability to expand the functionality to more file types. It looks like this will not work for PDF and PSD, at least without custom development and potentially UX drawbacks (long wait time).

thanks!
Alex

Thanks for explaining your use case! Given that there’s no way to crop PSD/PDF files without implementing format conversion, which may cause UX issues, I’d recommend you restrict these file types using validation and display a customized error message to users trying to upload an image that doesn’t fit your requirements. This article explains how to use this feature and contains code examples. Let me know if this helps.

1 Like

OK, I will take a look but for now we want to accept all file types, and just provide crop workflows for those which allow it. thanks for the help!

1 Like