You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bmpdata.Stride for a 24-bit bitmap is (or can be) padded to greater than the bitmap width, it looks like you already know that.
because you convert the samples in-place you will end up with rows of "stride" bytes, and you are carrying the padding through; In this case (1035 wide) you end up with an extra pixel on each line (from the bitmap padding). That pixel wraps to the next line causing a 45 degree shear or skew.
(Also there is a ScanLineSize which is clear about what Tiff is looking for).
And to fix it you need to track the source and destination indices separately in your convertSamples loop,
And maybe spend some memory on a new buffer of the right size, rather than using the same array.
I'm using the following code to save images to JPG compressed TIFs.
This works if the width of the input image is divisible by 8. If it's not, then the image will be skewed.
The helper functions i have are as follows:
If you run the above the 1040x800 document will look fine.
The same code will result in a skewed output for the 1035x800 one.
In addition, when this skewing happens, the console does print out a warning:
in-memory: Warning, fractional scanline discarded
Anyone have any idea what may be going on, and how I can fix this?
The text was updated successfully, but these errors were encountered: