Redth / ResizetizerNT

Add SVG's and PNG's to your shared Xamarin Project
MIT License
318 stars 31 forks source link

JPG compression #57

Open jpacov opened 3 years ago

jpacov commented 3 years ago

Maybe I'm missing some extra parmeter/configuration, but I'm processing JPG images and their sizes are extremely huge.

For example, this is my original source: 960x1280 => 141 kB And the generated xxhdpi for example: 960x1280 => 1.17 MB

This makes my output completely useless due to the huge size of final binary; I guess JPG compressor is not configured?

mrengineer7777 commented 2 years ago

Resizetizer isn't designed for JPGs. Convert your files to PNG (photos) or SVG (icons) and Resizetizer will work correctly. PNG is the recommended format for mobile app developers. If you supply an SVG Resizetizer will generate all the platform specific PNGs required. It's awesome.

bondarenkod commented 2 years ago

Resizetizer isn't designed for JPGs. Convert your files to PNG (photos) or SVG (icons) and Resizetizer will work correctly. PNG is the recommended format for mobile app developers. If you supply an SVG Resizetizer will generate all the platform specific PNGs required. It's awesome.

It depends on each use case. There is no universal answer for all cases. Rich-color full-screen size images can be * times larger than jpeg versions. There is no way to pack 20-30-50MB of images into your apk file, when it is expected to show these images only at first login. Just assume that it was in design, and you are not allowed to change anything.

bondarenkod commented 2 years ago

Maybe I'm missing some extra parmeter/configuration, but I'm processing JPG images and their sizes are extremely huge.

For example, this is my original source: 960x1280 => 141 kB And the generated xxhdpi for example: 960x1280 => 1.17 MB

This makes my output completely useless due to the huge size of final binary; I guess JPG compressor is not configured?

It would be a great idea! I'm also thinking that there should be an additional parameter that enables only image downscaling.

BTW processed files have only jpg extension, they are .png inside: https://github.com/Redth/ResizetizerNT/blob/319fc3f085021dea4e836c0072adc754b0436d66/Resizetizer.NT/SkiaSharpTools.cs#L68 image

That's why your files were increased in size.

bondarenkod commented 2 years ago

@jpacov fiy https://github.com/bondarenkod/ResizetizerNT/tree/jpeg-option

jpacov commented 2 years ago

@jpacov fiy https://github.com/bondarenkod/ResizetizerNT/tree/jpeg-option

Great @bondarenkod , I'll give it a try!!! Think about making a PR if this works

bondarenkod commented 2 years ago

RP is upcoming. I need some time to prepare the PR. But the feature is already working as I expected.