Open SuggonM opened 2 months ago
Please try something like the following:
// export
- dupe.toFile('./colors-dupe.png');
+ await dupe.toFile('./colors-dupe.png');
// export
- dupe.rotate(90).toFile('./colors-dupe.png');
+ await sharp('./colors-dupe.png').rotate(90).toFile('./colors-dupe-rotated.png');
The said change works 👍
Although, I can't really say I'm supportive with the idea of having to spawn an extra image and create another sharp instance for it.
Does this mean achieving it is impossible without first exporting into an intermediate file?
(more context would be welcome!)
I'm not quite sure if the title is accurate to Sharp's internal algorithm, but
joinChannel
does appear to exhibit an unusual behavior at least somewhere.As a very simple example to reproduce, I'm extracting all
4
channels asraw
from a colorful PNG, then joining those channels into a new instance of image. The expected result should be 1:1 duplicate of the original.Things seem to appear nice and fine until this point - the export is still 1:1 with the original. However, any further manipulation on the
dupe
from here on, will result in only thered
channel being affected. As an example, rotating by 90 degrees:This is my exact concern, as one would normally expect all 4 channels being manipulated as a whole.
In order to verify it's only the
red
channel being manipulated:colors-dupe.png
in GIMP.Channels
panel (next toLayers
panel).red
.red
channel appears rotated by 90 degrees.