foobaz / pngloss Goto Github PK
View Code? Open in Web Editor NEWLossy compression of PNG images
Home Page: https://frammish.org/pngloss/
License: Other
Lossy compression of PNG images
Home Page: https://frammish.org/pngloss/
License: Other
Maybe?:
dc[i] = color_distance(current, current+i)
dcs = sum(dc)
if (dcs > 0) {dc[i] /= dcs} else {dc[i] = 1.0/n}
ec[i] = error * dc[i]
Maybe?:
mkdir src
mv *.c *.h src
Line 13 in 2a67d09
OBJS = src/color_src/delta.o src/optimize_state.o src/pngloss_image.o src/pngloss_opts.o src/pngloss.o src/rwpng.o
Hi @foobaz .
Maybe you should use an adaptive model?:
quantization_strength_local = abs(current_pixel - mean(current_pixel + 3x3)) * options->strength / 10
./configure
runs fine, but make
gives:
Making all in src [80/7859]
make[1]: Entering directory '/data/git/pngloss/src'
gcc -DPACKAGE_NAME=\"pngloss\" -DPACKAGE_TARNAME=\"pngloss\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"pngloss\ 1.0.1\" -DPACKAGE_B
UGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pngloss\" -DVERSION=\"1.0.1\" -I. -I/usr/include/libpng16 -g -O2 -MT pngloss-color_delta
.o -MD -MP -MF .deps/pngloss-color_delta.Tpo -c -o pngloss-color_delta.o `test -f 'color_delta.c' || echo './'`color_delta.c
mv -f .deps/pngloss-color_delta.Tpo .deps/pngloss-color_delta.Po
gcc -DPACKAGE_NAME=\"pngloss\" -DPACKAGE_TARNAME=\"pngloss\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"pngloss\ 1.0.1\" -DPACKAGE_B
UGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pngloss\" -DVERSION=\"1.0.1\" -I. -I/usr/include/libpng16 -g -O2 -MT pngloss-optimize_st
ate.o -MD -MP -MF .deps/pngloss-optimize_state.Tpo -c -o pngloss-optimize_state.o `test -f 'optimize_state.c' || echo './'`optimize_stat
e.c
mv -f .deps/pngloss-optimize_state.Tpo .deps/pngloss-optimize_state.Po
gcc -DPACKAGE_NAME=\"pngloss\" -DPACKAGE_TARNAME=\"pngloss\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"pngloss\ 1.0.1\" -DPACKAGE_B
UGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pngloss\" -DVERSION=\"1.0.1\" -I. -I/usr/include/libpng16 -g -O2 -MT pngloss-pngloss_ima
ge.o -MD -MP -MF .deps/pngloss-pngloss_image.Tpo -c -o pngloss-pngloss_image.o `test -f 'pngloss_image.c' || echo './'`pngloss_image.c
mv -f .deps/pngloss-pngloss_image.Tpo .deps/pngloss-pngloss_image.Po
gcc -DPACKAGE_NAME=\"pngloss\" -DPACKAGE_TARNAME=\"pngloss\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"pngloss\ 1.0.1\" -DPACKAGE_B
UGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pngloss\" -DVERSION=\"1.0.1\" -I. -I/usr/include/libpng16 -g -O2 -MT pngloss-pngloss_opt
s.o -MD -MP -MF .deps/pngloss-pngloss_opts.Tpo -c -o pngloss-pngloss_opts.o `test -f 'pngloss_opts.c' || echo './'`pngloss_opts.c
mv -f .deps/pngloss-pngloss_opts.Tpo .deps/pngloss-pngloss_opts.Po
gcc -DPACKAGE_NAME=\"pngloss\" -DPACKAGE_TARNAME=\"pngloss\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"pngloss\ 1.0.1\" -DPACKAGE_B
UGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pngloss\" -DVERSION=\"1.0.1\" -I. -I/usr/include/libpng16 -g -O2 -MT pngloss-pngloss.o -
MD -MP -MF .deps/pngloss-pngloss.Tpo -c -o pngloss-pngloss.o `test -f 'pngloss.c' || echo './'`pngloss.c
mv -f .deps/pngloss-pngloss.Tpo .deps/pngloss-pngloss.Po
gcc -DPACKAGE_NAME=\"pngloss\" -DPACKAGE_TARNAME=\"pngloss\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"pngloss\ 1.0.1\" -DPACKAGE_B
UGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pngloss\" -DVERSION=\"1.0.1\" -I. -I/usr/include/libpng16 -g -O2 -MT pngloss-rwpng.o -MD
-MP -MF .deps/pngloss-rwpng.Tpo -c -o pngloss-rwpng.o `test -f 'rwpng.c' || echo './'`rwpng.c
mv -f .deps/pngloss-rwpng.Tpo .deps/pngloss-rwpng.Po
gcc -I/usr/include/libpng16 -g -O2 -lpng16 -lz -o pngloss pngloss-color_delta.o pngloss-optimize_state.o pngloss-pngloss_image.o pnglos
s-pngloss_opts.o pngloss-pngloss.o pngloss-rwpng.o
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_read_image24_libpng':
/home/pp/git/pngloss/src/rwpng.c:186: undefined reference to `png_create_read_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:192: undefined reference to `png_create_info_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:207: undefined reference to `png_set_option'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:221: undefined reference to `png_set_read_fn'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:223: undefined reference to `png_read_info'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:229: undefined reference to `png_get_IHDR'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:255: undefined reference to `png_set_gray_to_rgb'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:260: undefined reference to `png_get_valid'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:277: undefined reference to `png_set_interlace_handling'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:282: undefined reference to `png_read_update_info'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:284: undefined reference to `png_get_rowbytes'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_create_row_pointers':
/home/pp/git/pngloss/src/rwpng.c:117: undefined reference to `png_get_rowbytes'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_read_image24_libpng':
/home/pp/git/pngloss/src/rwpng.c:302: undefined reference to `png_read_image'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:307: undefined reference to `png_read_end'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:394: undefined reference to `png_destroy_read_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:202: undefined reference to `png_destroy_read_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:294: undefined reference to `png_destroy_read_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:213: undefined reference to `png_set_keep_unknown_chunks'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:217: undefined reference to `png_set_read_user_chunk_fn'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:264: undefined reference to `png_get_gAMA'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:240: undefined reference to `png_set_expand'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:241: undefined reference to `png_set_filler'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:251: undefined reference to `png_set_strip_16'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:194: undefined reference to `png_destroy_read_struct'
/usr/bin/ld: pngloss-rwpng.o: in function `user_read_data':
/home/pp/git/pngloss/src/rwpng.c:75: undefined reference to `png_get_io_ptr'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:79: undefined reference to `png_error'
/usr/bin/ld: pngloss-rwpng.o: in function `read_chunk_callback':
/home/pp/git/pngloss/src/rwpng.c:141: undefined reference to `png_get_user_chunk_ptr'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_error_handler':
/home/pp/git/pngloss/src/rwpng.c:655: undefined reference to `png_get_error_ptr'
/usr/bin/ld: pngloss-rwpng.o: in function `user_write_data':
/home/pp/git/pngloss/src/rwpng.c:94: undefined reference to `png_get_io_ptr'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_write_image_init':
/home/pp/git/pngloss/src/rwpng.c:449: undefined reference to `png_create_write_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:455: undefined reference to `png_create_info_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:471: undefined reference to `png_set_compression_level'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:472: undefined reference to `png_set_compression_mem_level'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:467: undefined reference to `png_destroy_write_struct'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:457: undefined reference to `png_destroy_write_struct'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_version_info':
/home/pp/git/pngloss/src/rwpng.c:43: undefined reference to `png_get_header_ver'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_write_image24':
/home/pp/git/pngloss/src/rwpng.c:524: undefined reference to `png_init_io'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:532: undefined reference to `png_set_write_fn'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:546: undefined reference to `png_set_unknown_chunks'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:610: undefined reference to `png_set_IHDR'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:610: undefined reference to `png_set_IHDR'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_write_end':
/home/pp/git/pngloss/src/rwpng.c:481: undefined reference to `png_write_info'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:486: undefined reference to `png_set_packing'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:488: undefined reference to `png_set_filter'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:490: undefined reference to `png_write_row'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:493: undefined reference to `png_set_filter'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:494: undefined reference to `png_write_row'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:500: undefined reference to `png_write_end'
/usr/bin/ld: /home/pp/git/pngloss/src/rwpng.c:502: undefined reference to `png_destroy_write_struct'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_set_gamma':
/home/pp/git/pngloss/src/rwpng.c:508: undefined reference to `png_set_gAMA'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_write_end':
/home/pp/git/pngloss/src/rwpng.c:484: undefined reference to `png_set_filler'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_create_row_pointers':
/home/pp/git/pngloss/src/rwpng.c:117: undefined reference to `png_get_rowbytes'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_write_end':
/home/pp/git/pngloss/src/rwpng.c:497: undefined reference to `png_write_image'
/usr/bin/ld: pngloss-rwpng.o: in function `rwpng_set_gamma':
/home/pp/git/pngloss/src/rwpng.c:511: undefined reference to `png_set_sRGB'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:346: pngloss] Error 1
make[1]: Leaving directory '/data/git/pngloss/src'
make: *** [Makefile:410: all-recursive] Error 1
Maybe add a comparison with XPNG to the documentation?
pngloss -s 40 -- lena.png
xpng lena.png lena.xpng20.png 20
Maybe (small optimize)?:
https://github.com/ImageProcessing-ElectronicPublications/pngloss/blob/f352ce0a00abac75848d643ee09a6d628f597e32/src/optimize_state.c#L398
https://github.com/ImageProcessing-ElectronicPublications/pngloss/blob/f352ce0a00abac75848d643ee09a6d628f597e32/src/optimize_state.c#L446
to:
int_fast16_t d = difference[c], dbak = 0;
...
d += dbak;
dbak = d / 4;
d -= dbak;
int_fast16_t twos = d / 16;
Dear William,
Could you be so kind to generate .exe
for the rest of us who are mere Windows users w/o compiler?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.