Browse Source

hard edges

master
Martin Dørum 4 years ago
parent
commit
232deb4bb7
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      blurrerbox.c

+ 5
- 3
blurrerbox.c View File

@@ -231,8 +231,8 @@ void write_jpg(FILE *out, unsigned char *image, int width, int height) {
jpeg_create_compress(&cinfo);
jpeg_stdio_dest(&cinfo, out);

cinfo.image_width = width;
cinfo.image_height = height;
cinfo.image_width = width - blur_radius * 2;
cinfo.image_height = height - blur_radius * 2;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;

@@ -244,7 +244,7 @@ void write_jpg(FILE *out, unsigned char *image, int width, int height) {
JSAMPROW row_pointer[1];

while (cinfo.next_scanline < cinfo.image_height) {
row_pointer[0] = &image[cinfo.next_scanline * bytes_per_line];
row_pointer[0] = &image[(cinfo.next_scanline + blur_radius) * bytes_per_line + blur_radius * 3];
jpeg_write_scanlines(&cinfo, row_pointer, 1);
}

@@ -263,6 +263,8 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error parsing resolution '%s'\n", argv[1]);
return EXIT_FAILURE;
}
desired_width += blur_radius * 2;
desired_height += blur_radius * 2;

FILE *in;
if (strcmp(argv[2], "-") == 0) {

Loading…
Cancel
Save