Closed aarondl closed 10 years ago
Yup. I'm seeing something similar here. Extremely subtle at first glance but take a look for yourself. I had a hunch and rolled resize back to the previous commit (like I did here).
resize git:(581d15c)
resize git:(bdfbbea)
Could you tell me which size the input images have and to which size you're resizing them to? While doing the optimizations, I had some numerical instabilities that where only visible at certain scale ratios. I thought that I sorted that out. Doesn't seem to be the case.
The original image is 600x450.
I rotated the image to 450x600.
I then processed it and the artifacts still exist.
Interestingly cropping gifs doesn't appear to have the issue?
Gifs are being processed as RGBA where I'm thinking pngs and jpgs are coming across as YCbCr.
I noticed this function call is the primary difference in the process. Just an observation for now. Who knows if it has value.
A different gif sample to show it isn't being effected.
This is the input image 28.jpg JPEG 320x180 320x180+0+0 8-bit DirectClass 11.3KB 0.000u 0:00.000
I'm resizing it so that the aspect ratio is kept, to a height of 630. Again, tried multiple filters, each seem to suffer from this in some form or another.
Hey there, I'm seeing this too.
My sample image from unsplash.com (http://33.media.tumblr.com/537d8986d6b8df79a9fd6901e7174fe2/tumblr_nbk5oaEN2n1st5lhmo1_1280.jpg) is 1280x848. Downsampled to 320x212 and the image suffers heavily from artifacting.
Fixed in 0c6a628df540d88783b3797728e6ad777e4722bc. The indexes used for reading the input images values were faulty and led to these artifacts. Regression from ccddecd1bf0b15e36e2ffcfdef7c6832eaa0dbf6.
Thanks so much for fixing this. This package is great by the way.
Thank you!
Hey @nfnt - I'm noticing the artifacts have returned using Go 1.3.1 and current resize. Here are the images:
The resize quality if really poor. I'm trying to gather more information. Oddly, I haven't noticed the issues when building from my other machine (same versions!). In both cases, I'm building with a target platform VM — so the environment is literally the same. It's strange!
I can confirm the issue is on both my computers - I just didn't notice it on the laptop because it's retina and the @2x was getting shrunk in the browser.
The artifacts you see are JPEG compression artifact and are not caused by this package. Try encoding the JPEG with a higher quality or encoding to a lossless image format like PNG.
You're right. Sorry for the false alarm @nfnt — I just realized the standard jpeg library uses a 75% compression const when encoding, which I need to override.
Great work on the package!
Here is an image resized with nfnt/resize on the left, and imagemagick on the right (using resize_to_fit from rmagick which should fallback to a resize using Lanczos followed by a crop).
Edit: I've tried multiple filters and they all seem to have this issue of making these lines. The one in the picture is from Lanczos 3.
I'm not sure what to make of it, only that it appears to have a lot of artifacts (scanlines?) in the one created by this package. Could be something I'm doing but all I do is use image.Draw to translate & crop.