mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2025-11-22 23:41:44 +00:00
resize fix for certain image sizes
This commit is contained in:
BIN
assets/mr.png
Normal file
BIN
assets/mr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 708 KiB |
@ -10,13 +10,15 @@ RESIZED_IMAGE=out/gigi.png
|
||||
RESIZED_LACED=out/gigi_laced.png
|
||||
REFERENCE_IMAGE=reference/gigi.png
|
||||
REFERENCE_LACED=reference/gigi_laced.png
|
||||
|
||||
TEST_IMAGE2=../../assets/Amiga2000.png
|
||||
RESIZED_IMAGE2=out/Amiga2000.png
|
||||
REFERENCE_IMAGE2=reference/Amiga2000.png
|
||||
RESIZED_LACED2=out/Amiga2000_laced.png
|
||||
REFERENCE_LACED2=reference/Amiga2000_laced.png
|
||||
|
||||
ODD_SIZE_IMAGE=../../assets/mr.png
|
||||
REFERENCE_ODD_SIZE=reference/mr.png
|
||||
ODD_SIZE=out/mr.png
|
||||
|
||||
|
||||
$(RESIZED_IMAGE): $(TEST_IMAGE) $(PROGRAM) Makefile
|
||||
@ -31,11 +33,15 @@ $(RESIZED_LACED): $(TEST_IMAGE) $(PROGRAM) Makefile
|
||||
$(RESIZED_LACED2): $(TEST_IMAGE2) $(PROGRAM) Makefile
|
||||
$(PROGRAM) --width=320 --height=512 --interlaced --blur=0.75 --input=$(TEST_IMAGE2) --output=$(RESIZED_LACED2)
|
||||
|
||||
test: $(RESIZED_IMAGE) $(RESIZED_LACED) $(RESIZED_IMAGE2) $(RESIZED_LACED2)
|
||||
$(ODD_SIZE): $(ODD_SIZE_IMAGE) $(PROGRAM) Makefile
|
||||
$(PROGRAM) --width=320 --height=512 --interlaced --blur=0.75 --input=$(ODD_SIZE_IMAGE) --output=$(ODD_SIZE)
|
||||
|
||||
test: $(RESIZED_IMAGE) $(RESIZED_LACED) $(RESIZED_IMAGE2) $(RESIZED_LACED2) $(ODD_SIZE)
|
||||
diff $(RESIZED_IMAGE) $(REFERENCE_IMAGE)
|
||||
diff $(RESIZED_LACED) $(REFERENCE_LACED)
|
||||
diff $(RESIZED_IMAGE2) $(REFERENCE_IMAGE2)
|
||||
diff $(RESIZED_LACED2) $(REFERENCE_LACED2)
|
||||
diff $(ODD_SIZE) $(REFERENCE_ODD_SIZE)
|
||||
@echo "______ ___ _____ _____ ___________ "
|
||||
@echo "| ___ \/ _ \ / ___/ ___| ___| _ \ "
|
||||
@echo "| |_/ / /_\ \\\\\ \`--.\ \`--.| |__ | | | | "
|
||||
|
||||
BIN
tools/resize/reference/mr.png
Normal file
BIN
tools/resize/reference/mr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 277 KiB |
@ -158,14 +158,22 @@ main(int argc, char **argv)
|
||||
|
||||
float wScale = 1.0;
|
||||
float hScale = 1.0;
|
||||
float configRatio = (float)config.width/(config.interlaced ? (float)config.height/2.0 : (float)config.height);
|
||||
int newWidth = config.width;
|
||||
int newHeight = config.height;
|
||||
|
||||
if (config.verbose) {
|
||||
printf("width = %d, height = %d = %f\n", width, height, (float)width/(float)height);
|
||||
printf("config.width = %d, config.height = %d = %f\n", config.width, config.height, configRatio);
|
||||
}
|
||||
|
||||
if (width >= height) {
|
||||
wScale = (float)height/(float)config.height;
|
||||
wScale = (float)height/(float)config.height;
|
||||
hScale = (float)width/(float)config.width;
|
||||
|
||||
if (width > height && wScale >= configRatio) {
|
||||
newWidth = width/wScale;
|
||||
} else {
|
||||
hScale = (float)width/(float)config.width;
|
||||
|
||||
newHeight = height/hScale;
|
||||
if (config.interlaced) {
|
||||
newHeight *= 2;
|
||||
|
||||
Reference in New Issue
Block a user