Show PNG Thumbnail as Transparent

646 views
Skip to first unread message

Brian Wilkins

unread,
Jan 27, 2014, 1:37:41 PM1/27/14
to resour...@googlegroups.com
In ResourceSpace, is it possible to show the thumbnail for a transparent PNG as a transparent PNG rather than a transparent PNG converted to a JPG?

Jeff Nova

unread,
Jan 27, 2014, 2:28:03 PM1/27/14
to resour...@googlegroups.com
Not at this time. Finally dealing with PNG transparency is pretty high up in our queue though!  2-3 weeks?

Jeff

--
Jeff Nova
Chief Executive Officer
Colorhythm LLC

Main Office:  +1 415-399-9921
Mobile:  +1 510-710-9590


On Jan 27, 2014, at 10:37 AM, Brian Wilkins <bwil...@gmail.com> wrote:

In ResourceSpace, is it possible to show the thumbnail for a transparent PNG as a transparent PNG rather than a transparent PNG converted to a JPG?

--
ResourceSpace: Open Source Digital Asset Management
http://www.resourcespace.org
---
You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mark Edwards

unread,
Jan 28, 2014, 12:34:44 PM1/28/14
to resour...@googlegroups.com
Thanks for the prompt reply, Jeff. Along with the PNG transparency fix, will it be possible to copy the image (and retain transparency) rather than having to download the file?

Jeff Nova

unread,
Jan 28, 2014, 3:53:32 PM1/28/14
to ResourceSpace
If we were to simply display an uploaded resource, a maliciously crafted one could cause trouble, whereas if it is crafted maliciously and an attempt to convert it fails, we have quarantined the potential harm. Is that a reasonable concern?  I'd rather represent the transparency as a checkerboard in a JPEG in preview.

Also, PNGs don't normally retain transparency when you copy from a browser window!  You usually have to download them, at least in Safari 7, AFAIK.

Best,
Jeff


On Tue, Jan 28, 2014 at 9:34 AM, Mark Edwards <medw...@gmail.com> wrote:
Thanks for the prompt reply, Jeff. Along with the PNG transparency fix, will it be possible to copy the image (and retain transparency) rather than having to download the file?

--

Bill

unread,
Jan 29, 2014, 8:19:35 AM1/29/14
to resour...@googlegroups.com
I like the idea of representing the transparency as a checkerboard in a JPEG preview. When looking at this would it be possible to give options as backgrounds? Something like $thumbnail_background_color="white" or "black". This would allow for better custom display of images with different themes.

Right now I have to modify the image_processing.php file to remove the digital artifacts from PNG file uploads. (https://groups.google.com/d/msg/resourcespace/b2u3N2D2sj4/n3xTAERZiUQJ)

With the background set to white, it works great with our current theme as there are no hard edges or box containers. It is a clean simple look where the images seem to flow. I do understand that this look does not work with every theme, that is why I would ask for the options if we use the JPEG previews.

Mark Edwards

unread,
Jan 29, 2014, 9:11:55 AM1/29/14
to resour...@googlegroups.com
I don't use Safari so I can't speak for it, but Chrome, Firefox and Internet Explorer all retain transparency in PNG format when copied from a browser window and pasted into another program. A quick search seems to indicate that the Safari PNG issue may have been related to mobile Safari and only an issue on iPad and iPhones. Not sure. 

All of the sites I use to grab icons and images from display them in PNG format and you can save them as PNG or just copy them to your clipboard and paste them in program of choice (PowerPoint, Word, Outlook email, etc). 

Here's an example of a bunch of png previews...


And here's an example of a particular png showing good transparency


I'm know malicious data could be stored in image formats. I'm not sure what sites like iconfinder.com do to protect themselves from that concern though. 

Quick background... I suggested we start using ResourceSpace at my company to manage digital (mostly graphics) assets and their respective licensing. The idea is that people would submit either downloaded (properly licensed) images, or custom images to the site along with all the relevant info, and then as a company we would have one place to go find images and be confident they are properly licensed. My main goals were that it be easy to upload and easy to grab images from the site. If its not easy people aren't going to use it. Right now I view the PNG tranparency issue as a bit of a road block. I was hoping it would be a bit more like the iconfinder site, and most image sites I've come across today.

Hope I've helped.

Cheers, 
Mark

Brian Wilkins

unread,
Jan 29, 2014, 9:26:37 AM1/29/14
to resour...@googlegroups.com
What about a concept of a "Safe" and "Unsafe" mode?

Jeff Nova

unread,
Jan 30, 2014, 6:48:18 PM1/30/14
to ResourceSpace
HI all!  We've released PNG transparency handling in r5233.  Please let us know how it works for you!  Thanks for your input.  Best, Jeff

Jeff Nova

unread,
Jan 30, 2014, 6:50:33 PM1/30/14
to ResourceSpace
I should add, we believe the checkerboard pattern to represent transparency is clearer to most users than simply allowing the user to view through the transparency in the RS environment - not where the PNG was intended to be viewed, very likely.  We expect to roll this out for GIFs and other formats with transparency, so please weigh in now if you believe this to be the wrong direction.  Thanks again!  Jeff

Brian

unread,
Jan 31, 2014, 8:16:51 AM1/31/14
to resour...@googlegroups.com
I have updated to the latest r5235. After uploading a png, I get "no preview" or just the png icon. I try the recreate preview with the same results. I am using multiple test images.

Jeff Nova

unread,
Jan 31, 2014, 10:37:33 AM1/31/14
to resour...@googlegroups.com, resour...@googlegroups.com
You pass installation check?  What version of imagemagick are you using?  Please email me an offending file. 


--
Jeff Nova
Chief Executive Officer
Colorhythm LLC

Main Office:  +1 415-399-9921
Mobile:  +1 510-710-9590

Brian Schwenk

unread,
Jan 31, 2014, 11:10:39 AM1/31/14
to resour...@googlegroups.com
This is great! I was just searching for a solution to the png problem earlier this week. Everything works just fine for us. One suggestion, though. It would be nice if the checkerboard pattern could always remain the same size. For the larger images the background just appears to be grey. But really as long as the weird artifacts are gone I'm happy. Thanks!

Inline image 1
screen.jpg

Brian

unread,
Jan 31, 2014, 12:17:52 PM1/31/14
to resour...@googlegroups.com
Yes install checks ok on everything, 

ImageMagick 6.8.0-1 2013-02-18 Q16

Brian

unread,
Jan 31, 2014, 1:43:55 PM1/31/14
to resour...@googlegroups.com
just upgraded ImageMagick 6.8.8-4. 

After I revert back to r5219 the png preview is created but has artifacts.


PHP version 5.4.24  (config: /usr/local/lib/php.ini) OK
MySQL version 5.5.34-cll  (client-encoding: utf8) OK
GD version bundled (2.1.0 compatible) OK
PHP.INI value for 'memory_limit' 1000M OK
PHP.INI value for 'post_max_size' 500M OK
PHP.INI value for 'upload_max_filesize' 500M OK
Write access to /home/master/public_html/filestore OK
Blocked browsing of 'filestore' directory OK
Large file support (64 bit platform) OK
ImageMagick Version: ImageMagick 6.8.8-4 Q16 x86_64 2014-01-31 http://www.imagemagick.org OK
FFmpeg FFmpeg 0.6.5 OK
Ghostscript GPL Ghostscript 8.70 (2009-07-31) OK
EXIF extension OK
ExifTool 8.80 OK
Last scheduled task execution (days) 0 OK
PHP extensions Core Reflection SPL SimpleXML bcmath calendar cgi-fcgi ctype curl date dom ereg exif filter ftp gd gettext hash iconv imagick imap json ldap libxml mbstring mysql openssl pcre posix session sockets sqlite3 standard timezonedb tokenizer xml xmlreader xmlwriter zip zlib

Jeff Nova

unread,
Jan 31, 2014, 1:46:49 PM1/31/14
to resour...@googlegroups.com
Send me examples of offending files. 


--
Jeff Nova
Chief Executive Officer
Colorhythm LLC

Main Office:  +1 415-399-9921
Mobile:  +1 510-710-9590

Brian

unread,
Jan 31, 2014, 3:51:55 PM1/31/14
to resour...@googlegroups.com
I found my issue. I do like the direction this is going. The code that was added to the image_processing.php ~line: 836 has a reference to global $storagedir;. You then a have reference to $storagedir."/../gfx/images/transparency.gif.

Our current $storagedir value set in our config.php points to a different path than the default filestore. So when the run_command tries to reference the transparency.gif using the $storagedir, if cannot find the image and errors out and no preview will be created because of this.

Once I set the path directly to the transparency.gif, all issues went away and I now have previews with the checkerboard background.

My fix you might want to use or have a better way of doing this:

Add to the config.default.php
$transparency_background = "gfx/images/transparency.gif";

image_processing.php ~line: 836
if ($extension=="png"){
global $transparency_background;
$transparencyreal=dirname(__FILE__) ."/../" . $transparency_background;
$wait=run_command(str_replace("identify","composite",$identify_fullpath)."  -compose Dst_Over -tile ".$transparencyreal." ".escapeshellarg($file)." ".escapeshellarg($file."2")." 2>&1");
$file=$file."2";
}


Any thought?

Tom Gleason

unread,
Jan 31, 2014, 9:44:14 PM1/31/14
to ResourceSpace
Good ideas.

Please check revision 5244. I've attempted to make the checkerboard
retain it's size, though this costs speed during preview creation.
Tom Gleason

Colorhythm LLC
http://www.colorhythm.com

Main Office: +1 415-399-9921
Fax: +1 415-399-9928
Mobile: +1 347-537-8465

tgle...@colorhythm.com

Jeff Nova

unread,
Jan 31, 2014, 10:03:27 PM1/31/14
to ResourceSpace
We also provided GIF transparency support, I might add!  Awesome work, Tom, and thanks to Spencer and the Colorhythm team for their efforts to support Tom's masterful work!  This looks great.

We will be working on PSD, TIFF, and EPS transparency next.  Those are VERY HARD though.

: )
Jeff

Brian Wilkins

unread,
Feb 3, 2014, 2:19:51 PM2/3/14
to resour...@googlegroups.com
Is this in ResourceSpace 6.1 ? We are using bitnami and it uses ResourceSpace 6.1.

Brian

Jeff Nova

unread,
Feb 3, 2014, 2:24:31 PM2/3/14
to resour...@googlegroups.com
Sorry, no. It will be included in the next release, and is available now from SVN. 

Jeff


--
Jeff Nova
Chief Executive Officer
Colorhythm LLC

Main Office:  +1 415-399-9921
Mobile:  +1 510-710-9590

B Gagne

unread,
Jul 8, 2014, 8:57:28 AM7/8/14
to resour...@googlegroups.com
I am reviewing the latest ResourceSpace (from svn) as an asset manager for the marketing and other digital assets at my company.

Many of our images are PNGs or PSDs with transparent backgrounds. I'm perfectly happy to have the preview of an image show a checkboard background, but it's the JPGs created for download that make no sense to me. They have the checkerboard background included in them! 

One of the draws of RS to me was that it created multiple image sizes so my colleagues don't need to grab the full sized file if they don't need something big - but at this point it's more confusing than ever for them because now, despite the existence of other formats of the file, I need to train them to always download the original. Ideally I'd want o see PNGs kept as PNGs. If they *must* be JPGs, at least make them JPGs with a white background.

Have I done something wrong in my setup or is this intentional?

Thanks!

Axel Dörfler

unread,
Jul 9, 2014, 7:42:27 AM7/9/14
to resour...@googlegroups.com
On Tue, Jul 8, 2014 at 2:57 PM, B Gagne <bga...@epiphan.com> wrote:
> Have I done something wrong in my setup or is this intentional?

That's intentional, however you can also configure the preview format.
Another option would be to use the format_chooser plugin. That one
allows you to convert files on the fly, and it will stick to the
original file format by default.

Bye,
Axel.

Brigitte Gagne

unread,
Jul 9, 2014, 8:34:54 AM7/9/14
to resour...@googlegroups.com
Thanks!

I understand why the preview would have checkerboards, but I'm curious in what circumstances someone would find it helpful for the small/large downloads to also include the checkerboard. The image file isn't useful to us (i.e can't be used in a presentation, or in any marketing collateral) unless it has a clean or transparent background.

I'll check out the format_chooser plugin today and see if I can figure out how to configure the preview format too.

Cheers.



--
ResourceSpace: Open Source Digital Asset Management
http://www.resourcespace.org
---
You received this message because you are subscribed to a topic in the Google Groups "ResourceSpace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/resourcespace/6ARNJwZnwH0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brigitte Gagne

unread,
Jul 9, 2014, 8:55:04 AM7/9/14
to resour...@googlegroups.com
Wow - format_chooser is exactly what I wanted! Thanks again Axel, nice work with it too!

Franck Horlaville

unread,
Oct 29, 2014, 3:05:00 PM10/29/14
to resour...@googlegroups.com
Hi Axel,

Is there an api for the format_chooser plugin ?

We are using the previews function to grab different file sizes through api but are hitting the same issue where our transparent pngs are being composited into jpgs with checkerboard, which we _do not_ want (we want to retain the transparency).

Additionally, why do you go through the trouble of compositing against checkerboard instead of doing this in the browser with css (display the transparent png over a checkerboard background) ?

Thanks

Franck Horlaville

unread,
Oct 29, 2014, 3:44:00 PM10/29/14
to resour...@googlegroups.com
I fixed it this way:

In include/config.php add:

#disable checkerboard compositing
$disable_checkerboard
=true;

In include/image_processing.php line 1168

replace: 

// checkerboard
if ($extension=="png" || $extension=="gif"){

with:

// checkerboard
global $disable_checkerboard;
if (!$disable_checkerboard && ($extension=="png" || $extension=="gif")){



Axel Dörfler

unread,
Oct 30, 2014, 4:29:48 AM10/30/14
to resour...@googlegroups.com
Hi Franck,

On Wed, Oct 29, 2014 at 8:05 PM, Franck Horlaville
<fhorl...@gmail.com> wrote:
> Is there an api for the format_chooser plugin ?

Nope.

> Additionally, why do you go through the trouble of compositing against
> checkerboard instead of doing this in the browser with css (display the
> transparent png over a checkerboard background) ?

RS uses JPGs for all preview images by default. Since those don't have
an alpha channel (outside Java, that is), there isn't much choice.
Of course, one could change it that it uses PNGs for transparent
images; I assume the implementation was done long before CSS could do
that.
In any case, patches welcome :-)

Bye,
Axel.

Franck Horlaville

unread,
Oct 30, 2014, 7:06:12 AM10/30/14
to resour...@googlegroups.com
Now of course this broke your api_search plugin which has jpg hardcoded for previews. I switched it to png there but now of course the files which happened to be real jpg files aren't found :-)

This needs a bit more diving into ...

I'll come back with a patch once I found a universal way

Thanks

Franck
Message has been deleted

Franck Horlaville

unread,
Nov 13, 2014, 10:12:05 AM11/13/14
to resour...@googlegroups.com
Hi Axel, here's a progress report.

- I now have jpg previews for jpgs and png previews for pngs, so it's looking promising.
- I have one bug left when calling the api_upload plugin
- I need to add a list of extensions for which the preview retains the extension

carrying on :-)


On Thursday, October 30, 2014 8:29:48 AM UTC, Axel Dörfler wrote:

Jeff Nova

unread,
Nov 13, 2014, 11:11:07 AM11/13/14
to resour...@googlegroups.com
The decision at the time was that converting the original was a security move so that originals that might be malicious didn't end up rendered and instead would fail in the conversion.

It's a bit of a paranoid decision, but that is why we went with checkerboard JPEGs rather than PNGs against CSS background.

We're now looking at ClamAV integration upstream from preview creation to catch malicious source materials. 

Jeff

--
Jeff Nova
Chief Executive Officer
Colorhythm LLC

Main Office:  +1 415-399-9921
Mobile:  +1 510-710-9590

--
ResourceSpace: Open Source Digital Asset Management
http://www.resourcespace.org
---
You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Opicron !

unread,
Nov 26, 2014, 3:25:40 PM11/26/14
to resour...@googlegroups.com
Cant wait, any updates on the PNG transparancy?

On Monday, January 27, 2014 8:28:03 PM UTC+1, Jeff Nova wrote:
Not at this time. Finally dealing with PNG transparency is pretty high up in our queue though!  2-3 weeks?

Jeff

--
Jeff Nova
Chief Executive Officer
Colorhythm LLC

Main Office:  +1 415-399-9921
Mobile:  +1 510-710-9590


On Jan 27, 2014, at 10:37 AM, Brian Wilkins <bwil...@gmail.com> wrote:

In ResourceSpace, is it possible to show the thumbnail for a transparent PNG as a transparent PNG rather than a transparent PNG converted to a JPG?

--
ResourceSpace: Open Source Digital Asset Management
http://www.resourcespace.org
---
You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Franck Horlaville

unread,
Nov 27, 2014, 3:54:15 AM11/27/14
to resour...@googlegroups.com
It's working !

I should amend it slightly to have a list of which types are to be kept but everything so far works like a charm for png and jpg
You received this message because you are subscribed to a topic in the Google Groups "ResourceSpace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/resourcespace/6ARNJwZnwH0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Opicron !

unread,
Nov 27, 2014, 11:06:18 AM11/27/14
to resour...@googlegroups.com
You have updated the format_chooser to accomodate your needs? Because here pngs are still transformed to jpg by default and I have not found an option to change it.

Looking forward to your thoughts.

Franck Horlaville

unread,
Nov 27, 2014, 5:47:20 PM11/27/14
to resour...@googlegroups.com
I've actually modified the core to create same-format previews. I'll release it shortly, need to find out how to do it properly

Sent from my iPhone

Opicron !

unread,
Nov 30, 2014, 3:53:11 PM11/30/14
to resour...@googlegroups.com
Thats great. I actually adjusted the format_chooser to do this. Very curious to your solution!
Reply all
Reply to author
Forward
0 new messages