esimov / caire

Content aware image resize library
MIT License
10.36k stars 384 forks source link

Enlarge doesn't work #65

Closed TornaxO7 closed 3 years ago

TornaxO7 commented 3 years ago

Describe the bug

I installed it from the AUR (`yay -S caire).

When I'm trying this command:

caire -perc=0 -width 3840 -height 1080 -in everyone.png -out test.png

than I'm getting this:

⚡ CAIRE is resizing the image... ✔
Error resizing the image:
    Reason: scale option can not be used on image enlargement

How can I expand the image to 3840x1080?

API related bug

I don't really know what to write here... (I'm not familiar with go)

Expected behavior

That I'm getting the same image just bigger.

Screenshots

image

Bug with the Desktop version (please complete the following information):

As I said in the beginning I installed it from the AUR and run it via CLI.

Additional context

esimov commented 3 years ago

I know the reason why this is happening. Because this operation requires a lot of computation taking into account the dimension of the image I limited the resized image size to a certain dimension. I will look into how can be this avoided.

esimov commented 3 years ago

I have fixed the reported issue. It came out that the issue was not related to what I have thought initially, but to some logical thing. I have improved also the error handling logic and replaced some of the dependency module. Please test it and let me know if you still experience the error.

TornaxO7 commented 3 years ago

Hm... it doesn't work somehow. So this is what happened:

image

As you can see the in.png and out.png didn't change. But interestingly on another image with 2732x1536 caire could convert it to 3840x1080 as expected (needed 37m and 2.99s for that, lol).

Here's the in.png file if you want to test it on your own:

![in](https://user-images.githubusercontent.com/50843046/121867121-e4115500-ccff-11eb-8da0-90094d5207ba.png)

And this is the image which worked (HINT: It might look a little bit scary, so be prepared!)

Input:

![everyone](https://user-images.githubusercontent.com/50843046/121867262-0c994f00-cd00-11eb-8919-8f58a7d856bd.png)

Output:

![out](https://user-images.githubusercontent.com/50843046/121867294-1a4ed480-cd00-11eb-81db-a6f0f0ed05f9.png)
esimov commented 3 years ago

Could you provide somehow also the image which didn't worked for you just for just for my own internal investigation. As a matter of the processing time, I know that this is a sensible part of this library, but unfortunately for large images the way how the algorithm is working I cannot foresee anything which might speedup the process. However there is a "workaround" which will decrease the processing time (as it is already described in README file) by using the -scale flag. I'm considering to get rid of this flag and use this option by default, but I would like to test it more thoroughly with various settings.

TornaxO7 commented 3 years ago

Could you provide somehow also the image which didn't worked for you just for just for my own internal investigation.

I already did. Did you click on these > Details "buttons"? Doesn't it look like this for you?

image

esimov commented 3 years ago

Sorry, I didn't saw it initially. I did a new commit, hopefully will work also for you. The generation should be a little bit faster now.

TornaxO7 commented 3 years ago

Yes! It works now with the arch wallpaper :D Thanks!

shivamshah commented 3 years ago

I installed CAIRE using brew command. Getting error when trying to enlarge the image. Command I am using: caire -in image.jpg -out ./out.jpg -height=4000 -debug=false

error

⚡ CAIRE is resizing the image... ✔
Error resizing the image:
    Reason: scale option can not be used on image enlargement

Also when using command caire -in input.jpg -out ./out.jpg -perc=1 -height=30 --width 0 -debug=false

It keeps on running endlessly.

⚡ CAIRE is resizing the image...
esimov commented 3 years ago

This issue has been resolved a while back, only that I haven't a rolled out a new release. Please ensure that you are using the latest 1.3..3 release. I'm pretty sure, that you are using a previous version.