<blockquote>
  <p>1) why?</p>
</blockquote>

<p>When you upload an image to Craft, the image is automatically “cleansed” using the same basic process that Craft uses to create image transforms. That happens to ensure that there are no malicious scripts hidden in the images, and it’s not something you can disable.</p>

<blockquote>
  <p>2) why is this not spelled out clearly in the documentation?</p>
</blockquote>

<p>Good point... we should probably mention it in the Assets section of the docs, or perhaps a knowledge base article. Will look into it.</p>

<blockquote>
  <p>3) Shouldn't Craft alert the user that it's altering your image so you don't spend hours trying to figure out what happened to your carefully planned images?</p>
</blockquote>

<p>It would get old soon, considering it happens for 99% of uploads.</p>

<blockquote>
  <p>4) how can I stop this from happening?</p>
</blockquote>

<p>Nothing natively, but you can bypass the whole process by manually FTP'ing up the images and running the Update Asset Indexes utility so Craft picks them up.</p>

<p>Worth noting that you might be better/more consistent results if your server is using Imagick over GD and make sure you're running a recent version of it.</p>

<p>There <em>is</em> a setting to this for GIFs you can disable mainly because animated GIFs  can contain hundreds of frames and transforming those can bring a server down. <a href="https://docs.craftcms.com/v3/config/config-settings.html#transformgifs" rel="nofollow noreferrer">https://docs.craftcms.com/v3/config/config-settings.html#transformgifs</a></p>

CC BY-SA 4.0
2020-05-14T00:19:33.200Z
I get the security, but why convert to 96 dpi? Is Craft doing that? Why not check the image dpi and use that? Most of our editors will never understand this is something Craft does. I forget too then ultimately refind the answer. I don't think this is user or editor friendly. A message that Craft transformed image would help with the confusion - when editing the image? Wish there was a way to bypass this feature of Craft though - it causes me a lot of extra work. Even using FTP, if you have a lot of images, using the image re-index utility takes time too. Wanting more control and transparency.
BrianMc
CC BY-SA 4.0
2020-05-14T20:30:42.077Z
@BrianMC: Just curious as to what's your use case here? DPI is a setting printers use for resolution, it actually has zero impact on the web. Web browsers use the pixel dimensions of your image (and CSS) to determine how big they display on screen, not DPI. However, if you have a legitimate use case, I'd love to hear it.
RitterKnight
CC BY-SA 4.0
2020-05-14T20:40:22.250Z
DPI does affect the image size. If I'm trying to keep page load down (the sum of all images on a page), and I'm targeting non-retina screens, I'm going to use 72dpi for that image and size my width and height of the image so it doesn't exceed display max. 96dpi is going to increase my image size even if I set it to the same width and height - my feeling is we need to be thinking about how can minimize image file size to deliver the smallest page load. So, I'm curious why is the assets tool transforming my images to 96 dpi and increasing my file size in the process?
BrianMc
CC BY-SA 4.0
2020-05-14T21:30:54.457Z
I think you're confusing retina images and DPI; they are not the same.  [DPI doesn't matter](https://daraskolnick.com/image-dpi-web/) only pixel dimensions do. To oversimplify, computers store rows and columns of dots called pixels. How many of those dots make up your image resolution (1024x1024). Craft isn't adding pixels where there aren't, which would increase the file size. However, what can affect image size is the quality (compression) you choose in your transforms. Retina images are bigger because they contain more pixels but are displayed at smaller sizes, making them appear crisper..
RitterKnight
CC BY-SA 4.0
2020-05-19T15:49:21.847Z
Dang it - you're right on the DPI thing... however, we are still ignoring a primary heavy handedness that Craft is imposing on images. If me as programmer or someone as editor works very hard to reduce their images, then use something like image optim to squeeze some bytes out, and I upload to assets using Craft mechanism, it is going to inflate the images through its own process. This process is not visible to the average user and likely go unnoticed. I really think there needs to be a better way to do this! Isn't there another way you can check if an image is a security risk?
BrianMc
CC BY-SA 4.0
2020-05-12T23:30:41.803Z
2020-05-12T23:33:36.073Z
2020-05-12T23:33:36.073Z
Brad Bell
<p>I've seen a couple strange things that Craft does when uploading images (like upsizing jpgs). The most recent, every time I upload a .png file it changes it's DPI from 72 to 96 for some unknown reason (why is this not in the documentation?) and it doesn't alert the user that it's doing so. </p>

<p>1) why?
2) why is this not spelled out clearly in the documentation?
3) Shouldn't Craft alert the user that it's altering your image so you don't spend hours trying to figure out what happened to your carefully planned images?
4) how can I stop this from happening? </p>

<assets><upload>
Uploading Assets - PNG changed from 72 dpi to 96
# Uploading Assets - PNG changed from 72 dpi to 96

(Asked by: username_0 on 2020-05-12)

I've seen a couple strange things that Craft does when uploading images (like upsizing jpgs). The most recent, every time I upload a .png file it changes it's DPI from 72 to 96 for some unknown reason (why is this not in the documentation?) and it doesn't alert the user that it's doing so.

1) why?
2) why is this not spelled out clearly in the documentation?
3) Shouldn't Craft alert the user that it's altering your image so you don't spend hours trying to figure out what happened to your carefully planned images?
4) how can I stop this from happening?

**Tags:** assets, upload


---

## 1 answers

### Answer by username_1 on 2020-05-12. Score: 1

> 1) why?

When you upload an image to Craft, the image is automatically “cleansed” using the same basic process that Craft uses to create image transforms. That happens to ensure that there are no malicious scripts hidden in the images, and it’s not something you can disable.

> 2) why is this not spelled out clearly in the documentation?

Good point... we should probably mention it in the Assets section of the docs, or perhaps a knowledge base article. Will look into it.

> 3) Shouldn't Craft alert the user that it's altering your image so you don't spend hours trying to figure out what happened to your carefully planned images?

It would get old soon, considering it happens for 99% of uploads.

> 4) how can I stop this from happening?

Nothing natively, but you can bypass the whole process by manually FTP'ing up the images and running the Update Asset Indexes utility so Craft picks them up.

Worth noting that you might be better/more consistent results if your server is using Imagick over GD and make sure you're running a recent version of it.

There *is* a setting to this for GIFs you can disable mainly because animated GIFs can contain hundreds of frames and transforming those can bring a server down. <https://docs.craftcms.com/v3/config/config-settings.html#transformgifs>

> **Comments:**
> **username_0**: I get the security, but why convert to 96 dpi? Is Craft doing that? Why not check the image dpi and use that? Most of our editors will never understand this is something Craft does. I forget too then ultimately refind the answer. I don't think this is user or editor friendly. A message that Craft transformed image would help with the confusion - when editing the image? Wish there was a way to bypass this feature of Craft though - it causes me a lot of extra work. Even using FTP, if you have a lot of images, using the image re-index utility takes time too. Wanting more control and transparency.  
> **username_2**: @BrianMC: Just curious as to what's your use case here? DPI is a setting printers use for resolution, it actually has zero impact on the web. Web browsers use the pixel dimensions of your image (and CSS) to determine how big they display on screen, not DPI. However, if you have a legitimate use case, I'd love to hear it.  
> **username_0**: DPI does affect the image size. If I'm trying to keep page load down (the sum of all images on a page), and I'm targeting non-retina screens, I'm going to use 72dpi for that image and size my width and height of the image so it doesn't exceed display max. 96dpi is going to increase my image size even if I set it to the same width and height - my feeling is we need to be thinking about how can minimize image file size to deliver the smallest page load. So, I'm curious why is the assets tool transforming my images to 96 dpi and increasing my file size in the process?  
> **username_2**: I think you're confusing retina images and DPI; they are not the same.  [DPI doesn't matter](https://daraskolnick.com/image-dpi-web/) only pixel dimensions do. To oversimplify, computers store rows and columns of dots called pixels. How many of those dots make up your image resolution (1024x1024). Craft isn't adding pixels where there aren't, which would increase the file size. However, what can affect image size is the quality (compression) you choose in your transforms. Retina images are bigger because they contain more pixels but are displayed at smaller sizes, making them appear crisper..  
> **username_0**: Dang it - you're right on the DPI thing... however, we are still ignoring a primary heavy handedness that Craft is imposing on images. If me as programmer or someone as editor works very hard to reduce their images, then use something like image optim to squeeze some bytes out, and I upload to assets using Craft mechanism, it is going to inflate the images through its own process. This process is not visible to the average user and likely go unnoticed. I really think there needs to be a better way to do this! Isn't there another way you can check if an image is a security risk?  

---

