0x09 / resdet

Detect source resolution of upscaled images
GNU Lesser General Public License v2.1
234 stars 10 forks source link

Got Invalid image #7

Closed rogerallen741 closed 3 years ago

rogerallen741 commented 4 years ago

For more discussions I open a new issue script. Here is the problem which i meet.

I already install libpng and libjpeg on my system(Ubuntu 16.04). However when I run resdet test.png it got the errors as bellow :

$ resdet test.png
Invalid image

Here is my config.mak

CC=/usr/bin/cc
AR=/usr/bin/ar
CFLAGS=-Ofast -march=native -mtune=native -std=gnu99 
PREFIX=/usr/local
BINPREFIX=/usr/local/bin
LIBPREFIX=/usr/local/lib
INCPREFIX=/usr/local/include
PCPREFIX=/usr/local/lib/pkgconfig
HAVE_FFTW=3
HAVE_LIBJPEG=1
HAVE_LIBPNG=1
DEFS= -DHAVE_LIBJPEG -DHAVE_LIBPNG=1 -I/usr/include/libpng12
LIBS= -ljpeg -lm -lfftw3f -lpng12

So the root cause may because of the libpng12 is not the resdet target version and the ImageMagick's libraries were not installed properly.

After install ImageMagick's libraries the problem was solved.

rogerallen741 commented 4 years ago

@zvezdochiot I add the RDENONE in typedef enum RDError ,but the output seems doesn't change. What is the propose of this change?

0x09 commented 4 years ago

@rogerallen741 I actually just built resdet with libpng 1.2.59 and was able to use it with your test file in https://github.com/0x09/resdet/issues/1#issuecomment-586872066 without any trouble.

Moreover, the png image reader takes precedence over imagemagick's for png files when both of these are enabled, meaning your version of libpng is actually being used and working right now.

You mentioned you initially encountered the error while running ./resdet test.png "Invalid image" will be somewhat misleadingly reported if resdet simply can't find the file provided; was it possibly something as simple as test.png not being in the current directory when you initially ran this?

zvezdochiot commented 4 years ago

@rogerallen741 say:

but the output seems doesn't change.

https://github.com/0x09/resdet/blob/21e21481fc3887bf87731c045e72e5a4b78ec2d7/lib/image.c#L81 Before return add debug info:

    printf("Image %s (%s): %u x %u / %u\n", filename, c, *width, *height, *nimages);