UIC doesn't support filtering by default, but you can easily fix that.
Open file "UICcodecimagepngencsrcuic_png_enc.cpp",
find "ExcStatus WriteHeader()" function,
and just after thefunction "png_set_write_fn(m_png_ptr, &m_write_info, pngWriteFunc, NULL);"
add new filter function "png_set_filter(m_png_ptr, 0,PNG_FILTER_SUB | PNG_FILTER_AVG| PNG_FILTER_PAETH);".
For detail information check "UICcodecimagepngcommonsrclibpng-1.2.35.txt" file.
Hi Pavel,
thanks for your quick reply.
I changed the code to the following (just in order to force a change in the resulting file size):
ExcStatus WriteHeader(void)
{
m_png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if(m_png_ptr == NULL)
return ExcStatusFail;
m_info_ptr = png_create_info_struct(m_png_ptr);
if(m_info_ptr == NULL)
{
png_destroy_write_struct(&m_png_ptr, png_infopp_NULL);
return ExcStatusFail;
}
if(setjmp(png_jmpbuf(m_png_ptr)))
{
png_destroy_write_struct(&m_png_ptr, &m_info_ptr);
return ExcStatusFail;
}
png_set_write_fn(m_png_ptr, &m_write_info, pngWriteFunc, NULL);
png_set_filter(m_png_ptr, 0, PNG_ALL_FILTERS);
printf("filteringn");
png_set_IHDR(
m_png_ptr, m_info_ptr, m_width, m_height, m_bit_depth, png_cmap[m_color],
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_write_info(m_png_ptr, m_info_ptr);
if(m_byteOrder)
png_set_swap(m_png_ptr);
return ExcStatusOk;
}
Unfortunately, the filtering does not change my resulting file size. Do I have to change the png_set_IHDR method accordingly? Do I miss something else?
Many thanks in advance and kind regards,
Norman