Bug 363968

Summary: Preview thumbnail in .kra/.ora files are sometimes cropped instead of full canvas
Product: [Applications] krita Reporter: Alvin Wong <alvin>
Component: File formatsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, griffinvalley, halla, raghu, simonandric5
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Other   
URL: https://github.com/alvinhochun/KritaShellExtension/issues/8
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: preview.png which is corrupted

Description Alvin Wong 2016-06-05 07:47:17 UTC
When saving a .kra or .ora file with transparent (alpha = 0) area at the boundary, the preview.png or Thumbnails/thumbnail.png inside the file is cropped to the minimum size such that no all-transparent rows and columns are present at the boundary.

If the image is completely transparent, preview.png or Thumbnails/thumbnail.png is completely empty with 0 bytes.

On the other hand, the mergedimage.png contains the full image uncropped.

This is causing inconsistent behaviour when external software tries to optimize thumbnail extraction by using the preview.png or Thumbnails/thumbnail.png for sizes within 256x256px.

Reproducible: Always
Comment 1 Halla Rempt 2016-11-01 12:30:48 UTC
Git commit 18fea2e5f5a153961a5d08e2e41dc2645e2fc5f8 by Boudewijn Rempt.
Committed on 01/11/2016 at 12:30.
Pushed by rempt into branch 'krita/3.1'.

M  +9    -1    libs/ui/KisDocument.cpp

http://commits.kde.org/krita/18fea2e5f5a153961a5d08e2e41dc2645e2fc5f8
Comment 2 Halla Rempt 2016-11-01 12:50:26 UTC
Git commit c8ccd8b8c5c4062b0210905a5d1f12c5a1381683 by Boudewijn Rempt.
Committed on 01/11/2016 at 12:49.
Pushed by rempt into branch 'krita/3.1'.

M  +14   -12   libs/ui/KisDocument.cpp

http://commits.kde.org/krita/c8ccd8b8c5c4062b0210905a5d1f12c5a1381683
Comment 3 Halla Rempt 2016-11-02 09:55:23 UTC
Git commit 345919cdef1cf9dd7bf331e1477316969af45b89 by Boudewijn Rempt.
Committed on 02/11/2016 at 09:51.
Pushed by rempt into branch 'rempt/impex-refactoring'.

M  +9    -1    libs/ui/KisDocument.cpp

http://commits.kde.org/krita/345919cdef1cf9dd7bf331e1477316969af45b89
Comment 4 Raghavendra kamath 2016-11-04 17:43:14 UTC
I found that after the commits for this bug. the preview.png that gets generated is mostly horrizontal lines and noise the so the previews are corrupted or not correct. 

an example preview.png extracted from the kra saved from krita after these commits can be viewed here -> https://dl.dropboxusercontent.com/u/37777793/preview.png
Comment 5 Raghavendra kamath 2016-11-04 17:44:10 UTC
Created attachment 102035 [details]
preview.png which is corrupted
Comment 6 Dmitry Kazakov 2016-11-10 10:38:08 UTC
Still actual. I have a feeling that it is somehow related to the asynchronous saving of the image. But I didn't check for any details yet.
Comment 7 wolthera 2016-11-12 13:55:10 UTC
Asynchronous saving was implemented after this bug started happening.
Comment 8 Halla Rempt 2017-01-23 14:45:18 UTC
Should be fixed now.