Comments (8)
Thanks @dpup for your little gif-resize example! I reworked it into a reusable package (58bb2e4), and it works great.
Original blob image:
https://raw.githubusercontent.com/dpup/go-scratch/master/gif-resize/blob.gif
Resized to 200px and rotated 90 degrees:
https://willnorris.com/api/imageproxy/200,r90,sWepT40QjkBVuX3IDUy87z1xlXCnx5clAOcxnoVHMq30/https://raw.githubusercontent.com/dpup/go-scratch/master/gif-resize/blob.gif
from imageproxy.
Nice, glad it worked for you. In practice we have seen some issues with this approach on some gifs, and it will increase the size of the generated image.
from imageproxy.
Yeah, I noticed that some resized images were a bit larger than I would have expected. Did you come up with an alternative approach?
from imageproxy.
We just lived with it, but we have started transcoding gifs to video files,
for this and other reasons. I think the algorithm would be something like
this:
- check every pixel against the previous frame.
- if the color matches, make pixel transparent.
- set the frame bounds to be the smallest rectangle that covers
non-transparent pixels.
On Sat, May 16, 2015, 9:52 PM Will Norris [email protected] wrote:
Yeah, I noticed that some resized images were a bit larger than I would
have expected. Did you come up with an alternative approach?—
Reply to this email directly or view it on GitHub
#23 (comment)
.
from imageproxy.
@dpup: in case you're interested, I achieved considerable file size savings and reduced the noise simply by maintaining the original color palette. So from your source shapes.gif (377K):
Your original resized version is 1.7M:
https://raw.githubusercontent.com/dpup/go-scratch/master/gif-resize/shapes.out.fixed.gif
My updated version that maintains the original color palette is 223K:
https://willnorris.com/api/imageproxy/250,sdhIVIA2xBZJRhiNgO2CXxyT-iZF84WxUnJSRW8bq8CA/https://raw.githubusercontent.com/dpup/go-scratch/master/gif-resize/shapes.gif
from imageproxy.
That'll cause resizing artifacts. A pixel's color in the resultant image
will be averaged across multiple pixels in the source image, and the
average may not exist in the palette.
On Mon, May 18, 2015, 3:47 PM Will Norris [email protected] wrote:
@dpup https://github.com/dpup: in case you're interested, I achieved
considerable file size savings and reduced the noise simply by maintaining
the original color palette. So from your source shapes.gif
https://raw.githubusercontent.com/dpup/go-scratch/master/gif-resize/shapes.gif
(377K):Your original resized version is 1.7M:
[image: shapes]
https://raw.githubusercontent.com/dpup/go-scratch/master/gif-resize/shapes.out.fixed.gifhttps://raw.githubusercontent.com/dpup/go-scratch/master/gif-resize/shapes.out.fixed.gif
My updated version that maintains the original color palette
5e9ceea
is 223K:—
Reply to this email directly or view it on GitHub
#23 (comment)
.
from imageproxy.
yeah, I did consider that. Though in practice (at least with images that have large swaths of solid colors like above), the result is still far better than the alternative. In any event, thanks again for publishing your original tool. I'll keep playing with a few different approaches (maybe try to compute a closer palette to take pixel merging into account), but I think this is a good 80% solution.
from imageproxy.
note for future me: go1.5 will expose frame disposal data, the global color palette, and the background color index (e6092d64)
from imageproxy.
Related Issues (20)
- avif HOT 1
- error out of nowhere x509: certificate has expired or is not yet valid HOT 2
- Memory Leak with invalid status code HOT 4
- There is no support of headers. I already fixed it. HOT 1
- Serving files from Azure HOT 2
- support for svg HOT 3
- migrate off of github.com/Azure/azure-sdk-for-go/storage
- can not cache using minio HOT 3
- ARMv7 (Raspberry PI) docker image support?
- How to upgrade existing installation of ImageProxy? HOT 2
- Persistent caching and no request on ressource after caching HOT 3
- Link to alternative and/or enhanced forks
- Denial of Service by Rendering Image that have very big pixel HOT 4
- Create binary in releases
- Ruby Client HOT 2
- Is there any way to remove metadata from images HOT 1
- Encoding remote url HOT 1
- Passing response headers HOT 2
- Possible native WebP encoder? HOT 4
- Support watermark
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imageproxy.