Memory consumption in Magick.NET

前端 未结 1 786
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-24 17:16

I have the following lines of code in a function. which reads the image from Amazon S3. Image size which i am reading is of 1.37 MB where as when i ran the profiler

相关标签:
1条回答
  • 2021-01-24 17:23

    Your image size on disk is not important for the size of the image in memory. The amount of memory that is necessary is related to the dimensions (width/height) of your image. When the image is loaded the raw data is 'converted' to pixel data. For each channel Magick.NET will use either 8 or 16 bit per pixel (Q8/Q16). So when you have an image that is 4 channels (RGBA) and you are using the Q16 version of Magick.NET you will use 64-bits per pixel. For an image of 1920x1080 you will need 1920*1080*64 = 132710400 bits, and that is around 16.5 Megabytes. The size on disk will be smaller most of the times because most image formats compress the pixel data when they save it to disk.

    0 讨论(0)
提交回复
热议问题