cloudinary-community / next-cloudinary

⚡️ High-performance image delivery and uploading at scale in Next.js powered by Cloudinary.
https://next.cloudinary.dev
MIT License
237 stars 64 forks source link

How to apply multiple AI transformations on the same image one after another #480

Closed p-galinov closed 1 month ago

p-galinov commented 1 month ago

Hello,

I have a NextJS application and I use the CldUploadWidget to upload images and the CldImage component to apply transformations.

What I'm trying to do is the following:

  1. The user uploads an image with guy with black shirt and black hat.

  2. Applies transformation (there is a form with 2 input fields) to recolor the shirt to be white with the recolor AI transformation and gets a new transformed image with a white shirt and black hat.

  3. The user wants to recolor the hat to be white as well so he applies a new transformation and here is the problem. Cloudinary will apply the second transformation on the original image, not the previously tranformed image and the result will be black shirt (from the original image) and white hat.

My question is - is it possible to apply AI transformations on already transformed images, so the users can make chain of AI transformations on the same image without the need to re-upload the image? I tried to pass the preserveTransformations={true} property on the CldImage but that didn't help and it was still using the original image, not the transformed one.

I also tried to make a state with an array from URLs with previous transformations, and even if I pass some of the new URLs to the src of the CldImage it still applies the transformation on the original image (feels like it's being cached is it possible to disable the cache?)

Any help will be highly appreciated!

Best regards,

colbyfayock commented 1 month ago

@p-galinov yeah, im not sure if that's possible without re-uploading, however, any chance you can provide me an example URL that i can check in with the team about it? if it's private and you're willing to send, you could DM it to me on Twitter (@colbyfayock), Discord (@colbyfayock), or I can share an email address

colbyfayock commented 1 month ago

Closing for now, but let me know if you want to follow up on this.