-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscale_test.c
35 lines (30 loc) · 1 KB
/
scale_test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "img.h"
#include "format-tga.h"
#include "scale.h"
int main(void)
{
AFB_IMAGE img_rgb = afb_image_init();
AFB_IMAGE img_pal = afb_image_init();
if (afb_format_tga_load
(&img_rgb, "test_images/TGA/kodim23/kodim23_rgb_no-rle_top-left.tga") != AFB_E_SUCCESS) {
printf("Could not load image\n");
return 1;
}
if (afb_format_tga_load
(&img_pal, "test_images/TGA/kodim23/kodim23_pal_no-rle_top_left.tga") != AFB_E_SUCCESS) {
printf("Could not load image\n");
return 1;
}
afb_scale_nearest_neighbor(&img_rgb, 600, 400);
afb_image_save(&img_rgb, "test_output_scale_rgb_2x.afb");
afb_scale_nearest_neighbor(&img_rgb, 150, 100);
afb_image_save(&img_rgb, "test_output_scale_rgb_0.5x.afb");
afb_scale_nearest_neighbor(&img_pal, 600, 400);
afb_image_save(&img_pal, "test_output_scale_pal_2x.afb");
afb_scale_nearest_neighbor(&img_pal, 150, 100);
afb_image_save(&img_pal, "test_output_scale_pal_0.5x.afb");
return 0;
}