# Can I use GR / Plots to create a pixel-perfect image?

**URL:** <https://discourse.julialang.org/t/can-i-use-gr-plots-to-create-a-pixel-perfect-image/77057>\
**Category:** Visualization\
**Tags:** plots, gr\
**Created:** [February 25, 2022, 11:43am UTC](https://discourse.julialang.org/t/can-i-use-gr-plots-to-create-a-pixel-perfect-image/77057 "2022-02-25T11:43:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xzackli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xzackli/32/38301_2.png) [@xzackli](https://discourse.julialang.org/u/xzackli)\
**Post date:** [February 25, 2022, 11:43am UTC](https://discourse.julialang.org/t/can-i-use-gr-plots-to-create-a-pixel-perfect-image/77057/1 "2022-02-25T11:43:37Z")

</div>

Is there a way to guarantee that no sampling occurs in GR, and i.e. my (3000, 4000) array is rasterized without any sampling? I want each pixel to correspond to an array element in my PNG. From reading the GR docs about [resampling](https://gr-framework.org/resampling_methods.html), it seems like it must store an internal raster representation. Naively I would specify `size` in Plots.jl to be the size of my array, but would this include things like ticks and labels?

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [February 25, 2022, 12:26pm UTC](https://discourse.julialang.org/t/can-i-use-gr-plots-to-create-a-pixel-perfect-image/77057/2 "2022-02-25T12:26:18Z")

</div>

Just to clarify, you have a plot that is ready (which is not simply an image plotted with heatmap) and you would like to save this plot with a specific resolution? Have you looked at `savefig` already? Maybe it has options to control the resolution and options to send the plot to an `IOBuffer` instead of a file on disk.

---

<div class="post-metadata">

**Author:** ![xzackli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xzackli/32/38301_2.png) [@xzackli](https://discourse.julialang.org/u/xzackli)\
**Post date:** [February 25, 2022, 12:34pm UTC](https://discourse.julialang.org/t/can-i-use-gr-plots-to-create-a-pixel-perfect-image/77057/3 "2022-02-25T12:34:00Z")

</div>

Sorry I wasn’t clear! I indeed have an image plotted with a heatmap, and I’m trying to avoid things like aliasing by having that image be unmodified by scaling, when I get the PNG of this heatmap.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [February 25, 2022, 1:04pm UTC](https://discourse.julialang.org/t/can-i-use-gr-plots-to-create-a-pixel-perfect-image/77057/4 "2022-02-25T13:04:19Z")

</div>

ImageView.jl ?

---

<div class="post-metadata">

**Author:** ![xzackli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xzackli/32/38301_2.png) [@xzackli](https://discourse.julialang.org/u/xzackli)\
**Post date:** [February 25, 2022, 1:08pm UTC](https://discourse.julialang.org/t/can-i-use-gr-plots-to-create-a-pixel-perfect-image/77057/5 "2022-02-25T13:08:35Z")

</div>

That’s fair – I’m willing to just use the JuliaImages machinery if my requirement is specifically to generate images! Thank you.
