I upload a PNG file and then split it into its red, green and blue components. I then save these components.
The original image is 1440 x 764 pixels, 2.21MB. But the 3 saved files are each 360x198 pixels, 96.9 KB.
Why is the output image so much smaller? Here's my code:
file = "C:\\myFile.png";
stem = "C:\\";
img = Import[file];
imgData = ImageData[img];
rgbData =
Table[ArrayPlot[imgData[[;; , ;; , n]],
ColorFunction -> (GrayLevel[#] & 1)], {n, 1, 3}];
Table[Export [FileNameJoin[{stem, ToString[n] <> ".png"}],
rgbData[[n]], "PNG"], {n, 1, 3}];
Image
rather thanArrayPlot
: mathematica.stackexchange.com/a/24124/2079 $\endgroup$ – george2079 Feb 20 '15 at 15:41Image
instead ofArrayPlot
and changedColorFunction->(blah)
toColorSpace->"Grayscale"
and I got the result I was looking for. But your comment is too short to accept as an answer. Could you expand a bit? Also -- why doesArrayPlot
reduce the image size? That doesn't make any sense to me. $\endgroup$ – lynvie Feb 20 '15 at 17:22