Image always converted to jpg?

When I upload a png image it's always converted into a jpg? How to stop that?
5 Replies
MURO⚡
MURO⚡OP2mo ago
so in stead of this const imagePath = "${folder}/${uniqueName}-${sizeName}.jpg"; something like:
const originalExtension = image.originalname.split('.').pop().toLowerCase();
const validExtensions = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'tiff'];
const extension = validExtensions.includes(originalExtension) ? originalExtension : 'jpg';
const originalExtension = image.originalname.split('.').pop().toLowerCase();
const validExtensions = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'tiff'];
const extension = validExtensions.includes(originalExtension) ? originalExtension : 'jpg';
so we can use: const imagePath = "${folder}/${uniqueName}-${sizeName}.${extension}"; I could make a PR for it it works locally, i can save as png
fedehusk
fedehusk2mo ago
talking about images — maybe the manifest could save images in their original size as well, so as not to use the file property?
brunobuddy
brunobuddy2mo ago
@MURO⚡ what format of image do you need to generate ? PNGs ? What is your pain point ? Manifest is using Sharp behind the scenes https://github.com/lovell/sharp so we could imagine other formats. We went for JPG to keep things simple first
GitHub
GitHub - lovell/sharp: High performance Node.js image processing, t...
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library. - lovell/sharp
MURO⚡
MURO⚡OP2mo ago
yes that was also a pain point, I simply fixed that with adding a large option in the backend file. I just need png so far, because i have a remove background functionality where i need to save the result png without it being forced to jpg. but are you guys gonna support this? or can i submit a pr for this?
brunobuddy
brunobuddy5w ago
@MURO⚡ sorry for the wait I will do it next week @MURO⚡ with Manifest 4.16.3 you can now upload PNGs ! Thank you for taking the time to report the issue 🙂

Did you find this page helpful?