BLumia / pineapple-pictures

A homebrew lightweight image viewer.
https://sourceforge.net/projects/pineapple-pictures/
MIT License
406 stars 51 forks source link

Images are pixelated when zoomed out #31

Closed 33KK closed 3 years ago

33KK commented 3 years ago

Screenshot

top: pineapple-pictures botton: gwenview

BLumia commented 3 years ago

https://github.com/BLumia/pineapple-pictures/blob/4c07a89ca3a8a9bec39c3ff3bc984849ef218bf5/app/graphicsview.cpp#L392-L399

Currently pineapple-pictures uses QGraphicsPixmapItem::setTransformationMode with SmoothTransformation to smooth image when zoomed out, not sure how Gwenview did, will investigate it later™.

By the way, did you mind share the original image so I can use that to test on my machine?

Thanks!

33KK commented 3 years ago

Can't give that image right now, any image should work. I feel like there's some other transformation going on, since it looks fine in flameshot recent uploads window, which uses QLabel with scaled QPixmap

BLumia commented 3 years ago

https://github.com/KDE/gwenview/blob/d82258c4318188993a428f51e4a205083a121602/lib/documentview/rasterimageitem.cpp#L120

I don't have an image that very suited for testing this issue right now. It seems like Gwenview uses the same method (not 100% sure, just did a quick look), may look into it later. It could be an interesting issue if Gwenview really does that and the behavior is not the same :p

BLumia commented 3 years ago

Just randomly drew an ellipse and seems I'm able to reproduce this issue.

Screenshot

Original image used to test this bug

Anyway, I'll investigate it later™.

BLumia commented 3 years ago

I'm probably using the QGraphicsView/QGraphicScene in a wrong way. Currently, when zooming in and out, the program will apply the scale to the graphics view instead of the image (QGraphicsPixmapItem) item. The SmoothTransformation mode applied to the item seems will only work when the scale transform is applied to the item.

Maybe I need to refactor some part of the code to resolve this issue, still not sure about this. Anyway confirmed this issue and this should be resolved in later updates.

BLumia commented 3 years ago

Hi and could you try if https://github.com/BLumia/pineapple-pictures/commit/36c54addce2f7ba34f43631276ca4ad901b5dc36 resolved this issue?

33KK commented 3 years ago

Looks good now, thanks

Preview thing is also not using SmoothTransform btw Screenshot

BLumia commented 3 years ago

Preview thing is also not using SmoothTransform btw Screenshot

The preview and the main area share the same graphics scene so only one of them could look smooth in the current implementation. It's just a navigation preview so I guess it's okay ;P

I'll close this issue then, let me know if you found any other issue :)

BLumia commented 3 years ago

Update: 36c54ad introduced a bug that has been fixed in 7a0ed5b. If you are using 36c54ad please consider update :)