1
$\begingroup$

Now, I would think that when I run the following code, I'd get a 20x20 pixel image I could copy as a PNG with all the pixels corresponding to the given(although in this case random) data. Instead, I get a 27x27 image where the data is in a smaller 24x25 box!

ComplexArrayPlot[RandomComplex[{0, 1 + I}, {20, 20}], 
 PlotRangePadding -> None, ImageSize -> {20, 20}]

I'm trying to create detailed images of fractals without any junk like borders and antialiasing clogging up my images. How can I get Mathematica to stop with this inanity and output the desired image?

$\endgroup$
4
  • $\begingroup$ Upon zooming in a little, I see this. What $Version are you using? $\endgroup$
    – Syed
    Commented Dec 8, 2022 at 20:32
  • $\begingroup$ @Syed My Version is "13.1.0 for Microsoft Windows (64-bit) (June 16, 2022)". Try right clicking the image, selecting "Copy Graphic", and pasting in Microsoft Paint or something. The dimensions are wrong. The raster data appears to have the correct data size though. $\endgroup$
    – Laff70
    Commented Dec 8, 2022 at 20:54
  • $\begingroup$ I get a rectangular image with a dark gray border, with the top left pixel being white. $\endgroup$
    – Syed
    Commented Dec 8, 2022 at 21:04
  • $\begingroup$ @Syed Same except there's no white pixel. I wonder if Mathematica has PNG construction functionality. $\endgroup$
    – Laff70
    Commented Dec 8, 2022 at 21:11

1 Answer 1

1
$\begingroup$

I was able to extrapolate the answer from this post. If you have a plot t1 and plug t1[1] into Image and export it, it gives the proper image in the new file. If instead you try to copy the image from Mathematica, it glitches out. It's a really odd inconsistency which should probably be fixed so it mimics the PNG created by the Export function.

t1 = ComplexArrayPlot[RandomComplex[{0, 1 + I}, {20, 20}]]
Export["Wolfram Mathematica/pic.png", Image[t1[[1]]]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.