Size of Image in RAM

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
I'm trying to optimize for Mobile.  Photoshop is playing tricks on me

given a 38K  jpg;

rect 3 X 5

552px w
736 px h
72 dpi (irrelevant for screen)

Open in Photoshop: it indicates 1.16M in RAM, but mode is 8 bit… but

but the online calculation sites for file size for that rect/bit-depth should make it only take up 398k or so, in RAM.

If I change the online calculator for that rect to "24 bit" it returns the exactly size  (1.16M) I'm seeing in photoshop…roughly 3X the size of the 8 bit, which is what we would expect.

So

1) Why is Photoshop reporting the files size as if it were 24 bit? and
2) Does LC have a function to check the size of an image in terms of RAM consumed? I couldn't find one in the dictionary.

BR  (thinking about affinity these days!)
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
I think I can answer the Photoshop question. It seems that 1.6 Mb size is the file size for PS to do its work in the application. If you save that file as a .psd, I suspect you’ll see a file size of 1.6 Mb.

I find the Save for Web dialog (in the File>Export menu) useful. You can choose the file type, compression amount, and see the original and compressed file size there.

Peter
 

> On Feb 7, 2017, at 10:45 PM, Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> I'm trying to optimize for Mobile.  Photoshop is playing tricks on me
>
> given a 38K  jpg;
>
> rect 3 X 5
>
> 552px w
> 736 px h
> 72 dpi (irrelevant for screen)
>
> Open in Photoshop: it indicates 1.16M in RAM, but mode is 8 bit… but
>
> but the online calculation sites for file size for that rect/bit-depth should make it only take up 398k or so, in RAM.
>
> If I change the online calculator for that rect to "24 bit" it returns the exactly size  (1.16M) I'm seeing in photoshop…roughly 3X the size of the 8 bit, which is what we would expect.
>
> So
>
> 1) Why is Photoshop reporting the files size as if it were 24 bit? and
> 2) Does LC have a function to check the size of an image in terms of RAM consumed? I couldn't find one in the dictionary.
>
> BR  (thinking about affinity these days!)
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
You say the mode is 8 bit.  I might be wrong, but I don’t believe JPEG supports 8 bit (256 color) images.  Even if it does technically, the format is not really intended for 8 bit images, but rather 16 bit or higher.

When I generate an 8 bit indexed color image in Photoshop and look at the Save As menu, JPEG is not an option.  If I instead choose Save for Web which allows saving as JPEG, the resulting image re-opens in Photoshop in RGB (24 bit color) mode.

So as I read question, you’re getting a 24 bit image because you’re saving in JPEG format.

If you really want to save as 8 bit color, use PNG or GIF.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design

> On Feb 7, 2017, at 7:45 PM, Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> I'm trying to optimize for Mobile.  Photoshop is playing tricks on me
>
> given a 38K  jpg;
>
> rect 3 X 5
>
> 552px w
> 736 px h
> 72 dpi (irrelevant for screen)
>
> Open in Photoshop: it indicates 1.16M in RAM, but mode is 8 bit… but
>
> but the online calculation sites for file size for that rect/bit-depth should make it only take up 398k or so, in RAM.
>
> If I change the online calculator for that rect to "24 bit" it returns the exactly size  (1.16M) I'm seeing in photoshop…roughly 3X the size of the 8 bit, which is what we would expect.
>
> So
>
> 1) Why is Photoshop reporting the files size as if it were 24 bit? and
> 2) Does LC have a function to check the size of an image in terms of RAM consumed? I couldn't find one in the dictionary.
>
> BR  (thinking about affinity these days!)
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
@ Scott:

That's not what I get if I open this image in Photoshop.  (CC 2017)



575 X 1000

http://wiki.hindu.org/uploads/img37.jpg


It is a JPEG, but under the mode menu it shows "RGB/8 Bit" and if I look under indexed colors it says "256"  definitely not 16bit (in which case we should see 65536 colors)

So, somehow this IS a JPG that at least reports in PS as 8 bit but shows it is taking 2.17 MB in RAM, which it would if it were 16 bit.

Scott Rossi wrote:

    When I generate an 8 bit indexed color image in Photoshop and look at the Save As menu, JPEG is not an option.  If I instead choose Save for Web which allows saving as JPEG, the resulting image re-opens in Photoshop in RGB (24 bit color) mode.
   
But, and this is interesting: if I save as PNG Photoshop offers the option to change turn off transparency and save as  bit… the resulting images on disk is 1/3 bigger I size  (jpeg,:229K, png:353K)  But the former/jpg opens in photoshop at 2.17MB and not the 8-bit PNG opens at 739K in RAM  

This tends to confirm your theory and Photoshop is miss reporting the bit depth on the jpg (or something!)  … very interesting. the PNG at half the size in RAM is visually indistinquishable from the JPG (at least to my eyes)

http://wiki.hindu.org/uploads/img37.png

So we have a trade off: use 8 bit PNG and pack more data than we have room for in the mobile app package. or optimize really small JPG's on disk that then take up twice the room in RAM!



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
Scott is right:
JPEG has exactly one _color_ mode: 16M = 2^24 (seen apart of 256 gray-color mode).

What you interpret as "8bit-color-mode" relates to the _compression_ mode which
also explains the relation filesize vs (uncompressed) size in memory.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
If your image was 256 colors, the Index > Mode menu would show Indexed Color checked, instead of RGB Color.

The RGB/8 Bit you’re seeing in the Photoshop menu actually reads “8 Bits/Channel” — an RGB image is 3 channels (red, green, blue), 8 bits each, so 24 bit color.

Again, if you really want your image limited to 256 colors, convert it to Indexed Color and save as PNG or GIF.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design

> On Feb 7, 2017, at 10:17 PM, Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> @ Scott:
>
> That's not what I get if I open this image in Photoshop.  (CC 2017)
>
>
>
> 575 X 1000
>
> http://wiki.hindu.org/uploads/img37.jpg
>
>
> It is a JPEG, but under the mode menu it shows "RGB/8 Bit" and if I look under indexed colors it says "256"  definitely not 16bit (in which case we should see 65536 colors)
>
> So, somehow this IS a JPG that at least reports in PS as 8 bit but shows it is taking 2.17 MB in RAM, which it would if it were 16 bit.
>
> Scott Rossi wrote:
>
>    When I generate an 8 bit indexed color image in Photoshop and look at the Save As menu, JPEG is not an option.  If I instead choose Save for Web which allows saving as JPEG, the resulting image re-opens in Photoshop in RGB (24 bit color) mode.
>
> But, and this is interesting: if I save as PNG Photoshop offers the option to change turn off transparency and save as  bit… the resulting images on disk is 1/3 bigger I size  (jpeg,:229K, png:353K)  But the former/jpg opens in photoshop at 2.17MB and not the 8-bit PNG opens at 739K in RAM  
>
> This tends to confirm your theory and Photoshop is miss reporting the bit depth on the jpg (or something!)  … very interesting. the PNG at half the size in RAM is visually indistinquishable from the JPG (at least to my eyes)
>
> http://wiki.hindu.org/uploads/img37.png
>
> So we have a trade off: use 8 bit PNG and pack more data than we have room for in the mobile app package. or optimize really small JPG's on disk that then take up twice the room in RAM!
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
On our copiers, we have the option of scanning to Compact PDF. All it does is use the highest compression for the embedded JPEG images. The copier will not allow the selection of Compact PDF if the color depth is set to grayscale or black and white. Hence, I believe you are correct in your assessment. Grayscale is essentially a 256 color (8 bit) image which uses only black as a color.

Bob S


On Feb 7, 2017, at 21:35 , Scott Rossi via use-livecode <[hidden email]<mailto:[hidden email]>> wrote:

You say the mode is 8 bit.  I might be wrong, but I don’t believe JPEG supports 8 bit (256 color) images.  Even if it does technically, the format is not really intended for 8 bit images, but rather 16 bit or higher.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Size of Image in RAM

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
It's very possible that for the purposes of efficiency, Photoshop allocates enough memory so that it can work on the file as though it were in 24 bit color mode. It may be that some filters do a temporary shift to 24 bit color to do their magic, then back to 8 bit. This is just a guess though. I wouldn't go by that. If Photoshop reports 8 bit, then it's 8 bit.

Bob S


On Feb 7, 2017, at 22:17 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]<mailto:[hidden email]>> wrote:

@ Scott:

That's not what I get if I open this image in Photoshop.  (CC 2017)



575 X 1000

http://wiki.hindu.org/uploads/img37.jpg


It is a JPEG, but under the mode menu it shows "RGB/8 Bit" and if I look under indexed colors it says "256"  definitely not 16bit (in which case we should see 65536 colors)

So, somehow this IS a JPG that at least reports in PS as 8 bit but shows it is taking 2.17 MB in RAM, which it would if it were 16 bit.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode