seems you are right. you can create an issue about this problem
TEST CODE
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat mat = imread("Astro_4D_stars_proper_radial_g_b_8mag_big.png");
vector<int> compression_params;
compression_params.push_back(IMWRITE_PNG_COMPRESSION);
compression_params.push_back(0);
compression_params.push_back(IMWRITE_PNG_STRATEGY);
compression_params.push_back(IMWRITE_PNG_STRATEGY_DEFAULT);
for (int i = 0; i < 10; i++)
for (int j = 0; j < 5; j++)
{
compression_params[1] = i;
compression_params[3] = j;
imwrite(format("PNG_STRATEGY_%d_PNG_COMPRESSION_%d.png", j, i), mat, compression_params);
}
imwrite("PNG_SAVED_DEFAULT.png", mat);
return 0;
}
here is the result sizes
Astro_4D_stars_proper_radial_g_b_8mag_big.png 1.966.656
PNG_SAVED_DEFAULT.png 3.245.449
PNG_STRATEGY_0_PNG_COMPRESSION_0.png 27.647.001
PNG_STRATEGY_0_PNG_COMPRESSION_1.png 3.157.900
PNG_STRATEGY_0_PNG_COMPRESSION_2.png 3.039.178
PNG_STRATEGY_0_PNG_COMPRESSION_3.png 2.904.732
PNG_STRATEGY_0_PNG_COMPRESSION_4.png 2.637.388
PNG_STRATEGY_0_PNG_COMPRESSION_5.png 2.582.198
PNG_STRATEGY_0_PNG_COMPRESSION_6.png 2.529.017
PNG_STRATEGY_0_PNG_COMPRESSION_7.png 2.523.274
PNG_STRATEGY_0_PNG_COMPRESSION_8.png 2.503.723
PNG_STRATEGY_0_PNG_COMPRESSION_9.png 2.477.291
PNG_STRATEGY_1_PNG_COMPRESSION_0.png 27.647.001
PNG_STRATEGY_1_PNG_COMPRESSION_1.png 3.157.900
PNG_STRATEGY_1_PNG_COMPRESSION_2.png 3.039.178
PNG_STRATEGY_1_PNG_COMPRESSION_3.png 2.904.732
PNG_STRATEGY_1_PNG_COMPRESSION_4.png 2.603.165
PNG_STRATEGY_1_PNG_COMPRESSION_5.png 2.566.294
PNG_STRATEGY_1_PNG_COMPRESSION_6.png 2.519.976
PNG_STRATEGY_1_PNG_COMPRESSION_7.png 2.515.584
PNG_STRATEGY_1_PNG_COMPRESSION_8.png 2.498.000
PNG_STRATEGY_1_PNG_COMPRESSION_9.png 2.475.941
PNG_STRATEGY_2_PNG_COMPRESSION_0.png 27.647.001
PNG_STRATEGY_2_PNG_COMPRESSION_1.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_2.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_3.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_4.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_5.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_6.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_7.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_8.png 5.175.597
PNG_STRATEGY_2_PNG_COMPRESSION_9.png 5.175.597
PNG_STRATEGY_3_PNG_COMPRESSION_0.png 27.647.001
PNG_STRATEGY_3_PNG_COMPRESSION_1.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_2.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_3.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_4.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_5.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_6.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_7.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_8.png 2.762.428
PNG_STRATEGY_3_PNG_COMPRESSION_9.png 2.762.428
PNG_STRATEGY_4_PNG_COMPRESSION_0.png 27.647.001
PNG_STRATEGY_4_PNG_COMPRESSION_1.png 3.642.295
PNG_STRATEGY_4_PNG_COMPRESSION_2.png 3.492.898
PNG_STRATEGY_4_PNG_COMPRESSION_3.png 3.347.030
PNG_STRATEGY_4_PNG_COMPRESSION_4.png 3.058.305
PNG_STRATEGY_4_PNG_COMPRESSION_5.png 2.988.217
PNG_STRATEGY_4_PNG_COMPRESSION_6.png 2.915.866
PNG_STRATEGY_4_PNG_COMPRESSION_7.png 2.904.503
PNG_STRATEGY_4_PNG_COMPRESSION_8.png 2.876.399
PNG_STRATEGY_4_PNG_COMPRESSION_9.png 2.849.642
EDIT: i tested both images (original and saved by OpenCV) in https://compress-or-die.com/analyze
only difference : original image's ColorType is Palette
and OpenCV's is RGB
i think the original image has only different tones of yellow and this is the reason for lesser size
please show the resizing code, so ppl can try to reproduce
yes . have added that now
@berak if you can look at this and help me
and which eso language would that be ?
and what does
destinationImage.toFile().length()
do ?and what is the original image size(dimension) ?
its java and destinationImage.toFile().length() prints the size of the image file
@berak what I have noticed is that -if I use resize to just one third of the original dimension , its size decreases ,but when I use 3840 * 2208 ,it increases. original size is 4000 * 2300
Why are you using format
toString
?@supra56 that should not cause the issue.I checked it using the debugger ,its picking that correctly.