Fixes in 2020/kurdyukov2

The Makefile now chmod +x makegif.sh as it's referred to in the
README.md.

Change word 'Depends' to 'Dependencies' in makegif.sh to read a bit
easier.

Make README.md a bit easier to read (as English is not Ilya's first
language).

Made the command Ilya suggests to make GIFs so that it makes use of the
command the judges suggested, noting that it's just an example.

Added middle name to my name to match my name as a winner.

Of course if Ilya objects to any of this (or any other entry of his) I'm
certainly okay with rolling back the changes (same with his other
entries) but I believe that this will make it a bit easier to try out
the entry.
This commit is contained in:
Cody Boone Ferguson committed 2023-02-19 08:25:30 -08:00
1 parent cbb3395551
commit a4b15edeea
3 files changed
+29 -14

No files matched your search

+4 -1
View File
@@ -417,7 +417,7 @@ MAY_NEED_GCC= gcc
#
OBJ= prog.o prog_png.o prog_ppm.o
DATA= sample.jpg
TARGET= prog prog_png prog_ppm
TARGET= prog prog_png prog_ppm makegif
#
ALT_OBJ=
ALT_TARGET=
@@ -439,6 +439,9 @@ prog_png: prog.png.c
prog_ppm: prog.ppm.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
makegif: makegif.sh
${CHMOD} +x $?
# alternative executable
#
alt: ${ALT_TARGET}
+24 -12
View File
@@ -37,7 +37,7 @@ What is the complexity? Is it obvious from the source code?
## Author's comments:
### Usage
This program divides the image into a specified number of rectangles. This process is content aware, so algorithm tries to match most of the information. However, it doesn't finds the best theoretically possible layout.
This program divides the image into a specified number of rectangles. This process is content aware, so algorithm tries to match most of the information. However, it doesn't find the best theoretically possible layout.
./prog 1000 input.jpg output.jpg
@@ -45,13 +45,15 @@ This program divides the image into a specified number of rectangles. This proce
You can build three versions, depending on the image format.
Default is JPEG version, if you have the *libjpeg* development package installed in your system, then `make` without arguments should do the thing.
Default is JPEG version; if you have the `libjpeg` development package installed
in your system, then `make` without arguments should do the right thing.
If you want to use *libjpeg* compiled from sources, then use `LIBS` define to specify the path to includes and the library.
If you want to use `libjpeg` compiled from sources, then use `LIBS` define to
specify the path to includes and the library.
make prog LIBJPEG="-Ijpeg-6b jpeg-6b/libjpeg.a"
Use this command to build a PNG version (you need *libpng*):
Use this command to build a PNG version (you need `libpng`):
make prog_png LIBPNG="-lpng"
@@ -61,7 +63,7 @@ And the PPM version (no additional dependencies, can read raw/ASCII PPM, writes
### Building on macOS
- Thanks to Cody Ferguson for this information!
- Thanks to Cody Boone Ferguson for this information!
First, make sure you have the compiler tools installed e.g. by:
@@ -71,7 +73,7 @@ Make sure you install [MacPorts](https://www.macports.org/install.php). Then do:
$ sudo port install jpeg libpng ImageMagick
The program itself doesn't need ImageMagick, install it only if you plan to make gifs from the results using "makegif.sh".
The program itself doesn't need ImageMagick, install it only if you plan to make GIFs from the results using `makegif.sh`.
After that’s installed you need to run make with these options:
@@ -79,15 +81,25 @@ After that’s installed you need to run make with these options:
### Notes
Made this thing while experimenting with the idea of representing an image with rectangles (lossy compression). It's not very good in that sense, but the results look funny, like a kind of cubism pixelart.
Made this thing while experimenting with the idea of representing an image with
rectangles (lossy compression). It's not very good in that sense, but the
results look funny, like a kind of cubism pixelart.
Do not use values above 50000, it gonna be slow.
Do not use values above 50000, it'll be slow.
To understand how this works, just try running with 1,2,3,4... number of rectangles. At each iteration, the rectangle with the biggest difference from the picture data is split (halves may have different size) horizontally or vertically to get the minimum difference.
To understand how this works, just try running with 1,2,3,4... number of
rectangles. At each iteration, the rectangle with the biggest difference from
the picture data is split (halves may have different size) horizontally or
vertically to get the minimum difference.
You can use this command to make a gif from output images (uses ImageMagick):
`convert -delay 10 -dither none -loop 0 $(ls out*.png | sort -V) $(ls out*.png | sort -rV) +map out.gif`
Also provided `makegif.sh` to aid with gif creation.
You can use this command to make a GIF from output images (uses ImageMagick).
For instance after running the command suggested by the judges:
convert -delay 10 -dither none -loop 0 $(ls out*.jpg | sort -V) $(ls out*.jpg | sort -rV) +map out.gif
Also provided `makegif.sh` to aid with GIF creation.
-----------------------------------------------------------------------------------------------------
Regular → Executable
+1 -1
View File
@@ -7,7 +7,7 @@ dir="gif"
[ $# -lt 3 ] && [ "$ext" = "png" -o "$ext" = "ppm" ] && prog="./prog_$ext"
[ -f "$image" ] || {
echo "Usage: makegif.sh image.jpg output.gif ./prog"
echo "Depends: ImageMagick, bc (basic calculator)"
echo "Dependencies: ImageMagick, bc (basic calculator)"
echo "Note: don't use large images (dimensions above 1000), ImageMagick may fail."
echo "Uses \"gif\" directory for temporary files."
exit 1