Commit Graph

145 Commits

Author SHA1 Message Date
Jan Schlicht
ca1e14ffbd Update Travis configuration. 2018-02-21 19:27:29 +01:00
Charlie Vieth
14554cc7da Support 411 and 410 subsampling rations for go1.5+ 2018-02-21 19:09:07 +01:00
Adam Thomason
874f89dba4 Don't resize inputs with zero width or height
Inputs having zero as both width and height were caught, but either one
alone caused a panic. This adds a test showing the old failing behavior
and adds a check for non-positive width/height. Since Resize doesn't
have an error return value, the behavior in this case is to return the
original image.

Fixes https://github.com/nfnt/resize/issues/52
2016-11-15 15:47:54 -08:00
nfnt
891127d8d1 Fix alpha pre-multiplication.
The alpha pre-multiplication was applied to an aggregate value an not to the color value. This could cause wrong colors for images with an alpha channel.
Fixes #47.
2016-07-24 22:55:20 +02:00
nfnt
4d93a29130 Separate color assignment and alpha pre-multiplication. 2016-01-09 12:25:12 +01:00
nfnt
0f9f918da3 Use RGBA, RGBA64 image types as output.
These image types use premultiplied alpha values which are also used during the interpolation. If we'd use NRGBA, NRGBA64 as output, we'd have to reverse the premultiplication.
2016-01-07 21:30:54 +01:00
Eugene Zagidullin
9780a95734 Oops 2016-01-07 21:30:54 +01:00
Eugene Zagidullin
5311ab3c51 Reverse alpha premultiplication 2016-01-07 21:30:54 +01:00
nfnt
579058ccc0 Test for color-casts due to wrong alpha-channel scaling. 2016-01-07 20:34:21 +01:00
nfnt
dc93e1b98c Fix wrong colors of resized image.YCbCr images.
Fixes issue #31.
The color value of every pixel of the resized image is created from the YCbCr
colors of the input image. Therefore each of the three components have the same
sample rate. This is the 4:4:4 chroma subsampling and the output images are
now created accordingly.
2015-05-27 10:54:45 +02:00
Jan Schlicht
a3789c3aed Merge pull request #34 from minodisk/master
Fix wrong color with RGBA input
2015-05-27 10:09:16 +02:00
minodisk
87f723015c Test same color with some color modes 2015-05-25 18:53:05 +09:00
minodisk
f430a41192 Fix wrong color with RGBA input 2015-05-25 18:20:03 +09:00
nfnt
f2d1b73023 Merge branch 'alpha_channel_fix'
Colors in image.RGBA, image.RGBA64 and generic types with alpha channel should
now resize correctly. There's a small performance hit for these image types even
if they don't use alpha channels though.
Fixes bug #26.
2015-05-12 16:00:13 +02:00
nfnt
3502bb8cd1 Merge branch 'NRGBA_support'
This adds optimized access to image.NRGBA, image.NRGBA64 types. Internally these
image types are now preferred as they are easier to handle if alpha channels are
used.
2015-05-12 15:50:27 +02:00
nfnt
03c3eb7832 Mention optimized access for image.NRGBA, image.NRGBA64 in README. 2015-05-12 15:47:43 +02:00
nfnt
563154816f Remove debugging directives. 2015-05-12 15:24:41 +02:00
nfnt
c3c062672a Reverse alpha-premultiplication for image.RGBA, image.RGBA64 and generic images
types.
2015-05-12 15:19:11 +02:00
nfnt
5a6676c19e Add test case for input data with pre-multiplied-alpha. 2015-05-12 15:18:07 +02:00
jst
ce86eacf20 Merge branch 'disintegration-pixel_coordinate' 2015-03-27 19:50:42 +01:00
jst
b8fbe1cf50 Merge branch 'pixel_coordinate' of https://github.com/disintegration/resize into disintegration-pixel_coordinate 2015-03-27 19:49:21 +01:00
jst
618f7ff07a Add test case for correct pixel coordinates after resize. 2015-03-27 19:48:18 +01:00
jst
45c239597b Fix compile error. 2015-03-25 20:23:07 +01:00
jst
beee5e27fe Add support for nearest-neighbor resize of NRGBA, NRGBA64 images. 2015-03-25 20:20:28 +01:00
jst
79dc2b616d Add functions for nearest-neighbor resize of NRGBA, NRGBA16. 2015-03-25 20:17:14 +01:00
jst
ebea2e66be Support image.NRGBA, image.NRGBA16 in resize.Resize function. 2015-03-25 18:47:07 +01:00
jst
daa7cf45d3 Return NRGBA images.
Resizing images with alpha channels is easier for NRGBA, NRGBA64 image types.
Support for these is added by providing the necessary resize functions.
2015-03-25 18:38:23 +01:00
disintegration
0feec06645 Dst pixel coordinate fix 2015-03-19 22:52:55 +03:00
jst
53e9ca890b Fix typos. 2015-03-18 20:19:43 +01:00
jst
4b952c4b95 Merge branch 'charlievieth-master' 2015-03-18 19:57:50 +01:00
jst
d67851ed1f Explain optimization. 2015-03-18 19:56:53 +01:00
Charlie Vieth
962e93a6e5 Merge branch 'optimization' 2015-03-15 18:01:18 -04:00
Charlie Vieth
076a9ce3b9 Limit spawned goroutines to GOMAXPROCS(0).
This change sets the number of spawned goroutines to the GOMAXPROCS
value set by the user.

Using more goroutines than available execution threads is slightly
detrimental to performance (~0.5%), and prevents users of the library
from controlling the number of spawned goroutines.
2015-03-15 17:59:38 -04:00
Charlie Vieth
d8255b0421 Optimize bound checks.
Optimizing the bound checks resulted in an overall 14% increase in
conversion performance.
2015-03-15 17:44:39 -04:00
Charlie Vieth
b09281bd36 Update benchmarks to focus on conversion performance.
Benchmark each interpolation function for RGBA and YCbCr images.
Reduce the image size used when benchmarking to reduce the influence of
memory performance on results.
2015-03-15 17:40:38 -04:00
jst
8f44931448 Merge branch 'master' of https://github.com/nfnt/resize 2014-12-17 11:23:53 +01:00
jst
9485f5475a Return input image if output dimensions equal input dimensions. 2014-12-17 11:10:53 +01:00
jst
87b3f9b017 Merge pull request #23 from dlackty/patch-1
Use SVG version badge for Travis CI
2014-12-03 19:40:17 +01:00
Richard Lee
f49722caca Use SVG version badge for Travis CI 2014-11-21 17:00:51 +08:00
jst
7e2ce0a2ea Go >=1.1 is needed for this package. 2014-10-24 14:47:00 +02:00
jst
13ea1287b3 Test using all available versions of Go. 2014-10-24 14:41:49 +02:00
jst
20c6afea04 Remove unnecessary benchmark 2014-09-15 11:58:05 +02:00
jst
0c6a628df5 Resolve image artifacts due to wrong coefficient index lookup. 2014-09-15 11:50:59 +02:00
jst
581d15cb53 Fix parallel computation. 2014-08-20 21:12:39 +02:00
jst
e950449c49 Fix wrong boundary calculation (bug #17)
This fix doesn't currently work concurrently. This will be fixed in another commit.
2014-08-20 20:54:59 +02:00
jst
03982f698d Merge branch 'charlievieth-master' 2014-08-13 20:13:24 +02:00
jst
220cad3343 Add simple test case for input image with non-trivial bounds. 2014-08-13 20:12:18 +02:00
jst
7f8a5419ae Merge branch 'master' of https://github.com/charlievieth/resize into charlievieth-master 2014-08-13 20:10:38 +02:00
Charlie Vieth
df655f3f70 Merge branch 'YCC' 2014-08-12 16:11:40 -04:00
Charlie Vieth
08b124d541 Fix bound out of range panic. 2014-08-12 16:11:25 -04:00