Bug 462417 - Krita Version 5.1.1 & 5.1.3 not reading in a psd file well and Krita version 4.4.5 reads it in fine
Summary: Krita Version 5.1.1 & 5.1.3 not reading in a psd file well and Krita version ...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 5.1.1
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: amyspark
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-11-30 01:17 UTC by TG
Modified: 2022-12-23 18:24 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Krita version 5.1.1 distorted .psd file (241.93 KB, image/png)
2022-11-30 01:19 UTC, TG
Details

Note You need to log in before you can comment on or make changes to this bug.
Description TG 2022-11-30 01:17:47 UTC
SUMMARY

I have a .psd file with many layers that when I open it in Krita version 4.4.5 it opens fine with all of the layers and the images are all correct.  When I try and open the same file in Krita version 5.1.1 or Krita version 5.1.3, all of the layers are there but the image file is distorted with horizontal colored lines (see attachment)

STEPS TO REPRODUCE
1.    contact me if you want the .psd file that is causing the issue
2.    Install Krita version 4.4.5 and open file, file is good, close without saving
3.    Install Krita version 5.1.3 and open file, file images are distorted

OBSERVED RESULT
When I open the file in Krita version 4.4.5 the files opens fine and all of the images on each layer are fine.
When I open the same file in Krita version 5.1.1 or 5.1.3 the file opens fine with all of the layers, however the images for some of the layers have distorted horizontal colored lines

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows:  Home 11
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 TG 2022-11-30 01:19:07 UTC
Created attachment 154157 [details]
Krita version 5.1.1 distorted .psd file
Comment 2 Halla Rempt 2022-12-08 13:08:30 UTC
Could you please attach the original psd file instead of a screenshot?
Comment 3 TG 2022-12-09 18:29:19 UTC
Here is the  .psd file that causes the distorted image when imported using Krita 5.1.1 or Krita 5.1.3
This file opens fine in Krita 4.something

If the .psd file is too large it can be accessed here "https://drive.google.com/file/d/170JPio5Qg1XySaMIR6nJpXi3ow0aJ_b2/view?usp=sharing"
Comment 4 amyspark 2022-12-10 02:04:52 UTC
Taking it, let's see what I can find.
Comment 5 TG 2022-12-12 20:32:43 UTC
(In reply to amyspark from comment #4)
> Taking it, let's see what I can find.

Very good, thank you
Comment 6 amyspark 2022-12-22 21:36:45 UTC
The file you supplied does not comply with the PackBits compression scheme. In v5, I ensured that whenever the decompression routine throws an error code, it is acted upon by zeroing the relevant row, which is causing this bug.

The workaround is easy, but I'd like to confirm first why this is the case.
Comment 7 amyspark 2022-12-23 13:47:34 UTC
Git commit 5b48a3994c0161685cebad10db10c93669e16ca6 by L. E. Segovia.
Committed on 23/12/2022 at 13:47.
Pushed by lsegovia into branch 'master'.

PSD: reimplement the PackBits decompressor

This commit reimplements the decompression routine in C++11 to enable
proper bounds checking, logging, and skipping the unnecessary copies.

M  +44   -93   libs/psdutils/compression.cpp

https://invent.kde.org/graphics/krita/commit/5b48a3994c0161685cebad10db10c93669e16ca6
Comment 8 amyspark 2022-12-23 13:55:01 UTC
Git commit 0f826dd72121d873450f9e2b72e6df82c04169ea by L. E. Segovia.
Committed on 23/12/2022 at 13:54.
Pushed by lsegovia into branch 'krita/5.1'.

PSD: reimplement the PackBits decompressor

This commit reimplements the decompression routine in C++11 to enable
proper bounds checking, logging, and skipping the unnecessary copies.

M  +44   -93   libs/psdutils/compression.cpp

https://invent.kde.org/graphics/krita/commit/0f826dd72121d873450f9e2b72e6df82c04169ea
Comment 9 TG 2022-12-23 18:24:13 UTC
(In reply to amyspark from comment #8)
> Git commit 0f826dd72121d873450f9e2b72e6df82c04169ea by L. E. Segovia.
> Committed on 23/12/2022 at 13:54.
> Pushed by lsegovia into branch 'krita/5.1'.
> 
> PSD: reimplement the PackBits decompressor
> 
> This commit reimplements the decompression routine in C++11 to enable
> proper bounds checking, logging, and skipping the unnecessary copies.
> 
> M  +44   -93   libs/psdutils/compression.cpp
> 
> https://invent.kde.org/graphics/krita/commit/
> 0f826dd72121d873450f9e2b72e6df82c04169ea

Not sure what all of the above comment means, but it sounds like the problem was determined, a fix created and krita version 5.1 will not have this error.  Thank you