-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize from raw image data, not a file #25
Comments
You are welcome! Processing of images as data is already there. You've guessed method name |
oh, heh, funny :). Now I've replaced: io = IO.popen("/usr/bin/jpegtran -optimize /proc/self/fd/0", "r+").binmode With: When I'm saving with active record 4.0.2 the script that just worked suddenly crashes with "Error: invalid byte sequence in UTF-8" .. is there any gotcha in what format optimize_image_data() returns the optimized data? |
Hm, ok. The IO.popen-hack returned ASCII-8BIT and optimized_image_data returns UTF-8. I'll have to dig further on my side why it crashes my database save, not a image_optim problem. Thanks again! |
In reality |
v0.10.1 out |
Things are moving fast, I like it :). Just got bitten by another thing ...optimize_image_data seems to return nil if no optimization is done? Maybe that's the desired behavior? I was just expecting it to return imagedata as optimized as possible (sometimes that means the original image). |
|
First, thanks for a great lib!
Sometimes in scripts, I already have the imagedata, maybe I've cut up thumbnails for a bigger image or whatever.
It would be nice to be able to optimize that imagedata Without having to first save it to a file so image_optim can read it.
Maybe a new method to not break the current API:
image_optim.optimize_image_data( image_data )
The text was updated successfully, but these errors were encountered: