Suggestion - PSD conversion

Pulver

Joined: 2003-03-18
Posts: 14
Posted: Tue, 2003-03-18 21:33

Hello, I´m a newbie here, and I have a feature suggestion.
(I have searched without finding answers)

I´m a photographer - and would love to see support for PSD and TIF files.
That would mean that you could use Gallery to "file" high resolution images while making a webgallery at the same time.
I´ve edited Gallery to allow psd files (as described in <!-- BBCode Start --><A HREF="http://gallery.menalto.com/modules.php?op=modload&amp;name=phpBB_14&amp;file=index&amp;action=viewtopic&amp;topic=4634&amp;19918" TARGET="_blank">This</A><!-- BBCode End --> thread)

But it still says "Error: Invalid image:" - when I try to upload.

I know that imagemagick supports image conversion (from Tif to Jpeg for exampel) - then it would probably be possible to upload a high resolution Tif image - and gallery could convert it to jpeg, resize it and make thumbnails etc.

That would be great! :smile:

(even if I know that the one problem would be the filesize of the PSD and TIF images)

 
Gaile

Joined: 2002-07-20
Posts: 1301
Posted: Tue, 2003-03-25 07:42

Hi

ImageMagick and Netpbm can both handle tiff files, but neither of them mention psd in the documentation I searched. Since psd is PhotoShop's default file extension, and isn't actually intended to be viewed on a web browser it might be difficult to have an online program like Gallery set to handle files with the .psd extension.

You can still use the tif (tiff) extension, but I hate to think how much webspace you'd take up after awhile. As well, the wait time for viewing the image online would be slow even with adsl. I burn all my original digital images to CD - are you thinking of storing the raw images so they can be printed through a photo service like Shutterfly or is there another reason?

...just call me curious...

Gaile

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Tue, 2003-03-25 09:38
Quote:
Hi

ImageMagick and Netpbm can both handle tiff files, but neither of them mention psd in the documentation I searched. Since psd is PhotoShop's default file extension, and isn't actually intended to be viewed on a web browser it might be difficult to have an online program like Gallery set to handle files with the .psd extension.

70% right. ImageMagick can handle PS files [ http://imagemagick.sourceforge.net/www/formats.html ] but it's very slow. I'm working on something where the thumb and resized images are jpgs, but as most (all?) browsers cannot display PSD files, eventually you'd have to download a file. I haven't decided if it's useful or not.

Quote:
You can still use the tif (tiff) extension, but I hate to think how much webspace you'd take up after awhile. As well, the wait time for viewing the image online would be slow even with adsl. I burn all my original digital images to CD - are you thinking of storing the raw images so they can be printed through a photo service like Shutterfly or is there another reason?

My users want it so they can share Photoshop techniques. I think it is just too clumsly to be useful.

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Tue, 2003-03-25 16:17

I've decided to abandon my PSD support attempt. But if you use the patch below, it should allow you to upload PSD, and get JPG thumbnails.<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
Index: util.php
===================================================================
RCS file: /home/cvs/gallery/util.php,v
retrieving revision 1.19
diff -c -r1.19 util.php
*** util.php 23 Mar 2003 13:29:25 -0000 1.19
--- util.php 25 Mar 2003 16:02:21 -0000
***************
*** 276,282 ****
}

function acceptableImageList() {
! return array('jpg', 'gif', 'png');
}

function acceptableFormatList() {
--- 276,285 ----
}

function acceptableImageList() {
! return array('jpg', 'gif', 'png', 'psd');
! }
! function noDisplayImageList() {
! return array('psd');
}

function acceptableFormatList() {
***************
*** 287,292 ****
--- 290,298 ----
return in_array($tag, acceptableImageList());
}

+ function isNoDisplayImage($tag) {
+ return in_array($tag, noDisplayImageList());
+ }
function isMovie($tag) {
return in_array($tag, acceptableMovieList());
}
***************
*** 510,515 ****
--- 516,522 ----
case 1: // GIF
case 2: // JPEG
case 3: // PNG
+ case 5: // PSD
return 1;
break;
default:
Index: classes/AlbumItem.php
===================================================================
RCS file: /home/cvs/gallery/classes/AlbumItem.php,v
retrieving revision 1.5
diff -c -r1.5 AlbumItem.php
*** classes/AlbumItem.php 18 Feb 2003 02:54:24 -0000 1.5
--- classes/AlbumItem.php 25 Mar 2003 16:02:22 -0000
***************
*** 392,421 ****
$this->thumbnail->setDimensions($w, $h);
} else {
/* Make thumbnail (first crop it spec) */
if ($pathToThumb) {
! $ret = copy ($pathToThumb,"$dir/$name.thumb.$tag");
} else if ($this->image->thumb_width > 0)
{
$ret = cut_image("$dir/$name.$tag",
! "$dir/$name.thumb.$tag",
$this->image->thumb_x,
$this->image->thumb_y,
$this->image->thumb_width,
$this->image->thumb_height);
if ($ret) {
$ret = resize_image("$dir/$name.thumb.$tag",
! "$dir/$name.thumb.$tag", $thumb_size);
}
} else {
! $ret = resize_image("$dir/$name.$tag", "$dir/$name.thumb.$tag",
$thumb_size);
}

if ($ret) {
$this->thumbnail = new Image;
! $this->thumbnail->setFile($dir, "$name.thumb", $tag);

! list($w, $h) = getDimensions("$dir/$name.thumb.$tag");
$this->thumbnail->setDimensions($w, $h);

/* if this is the highlight, remake it */
--- 392,426 ----
$this->thumbnail->setDimensions($w, $h);
} else {
/* Make thumbnail (first crop it spec) */
+ $thumbTag=$tag;
if ($pathToThumb) {
! $ret = copy ($pathToThumb,"$dir/$name.thumb.$thumbTag");
} else if ($this->image->thumb_width > 0)
{
$ret = cut_image("$dir/$name.$tag",
! "$dir/$name.thumb.$thumbTag",
$this->image->thumb_x,
$this->image->thumb_y,
$this->image->thumb_width,
$this->image->thumb_height);
if ($ret) {
$ret = resize_image("$dir/$name.thumb.$tag",
! "$dir/$name.thumb.$thumbTag", $thumb_size);
}
+ } else if (isNoDisplayImage($tag)) { // build jpg from PSD file
+ $thumbTag="jpg";
+ $ret = resize_image("$dir/$name.$tag", "$dir/$name.thumb.$thumbTag",
+ $thumb_size);
} else {
! $ret = resize_image("$dir/$name.$tag", "$dir/$name.thumb.$thumbTag",
$thumb_size);
}

if ($ret) {
$this->thumbnail = new Image;
! $this->thumbnail->setFile($dir, "$name.thumb", $thumbTag);

! list($w, $h) = getDimensions("$dir/$name.thumb.$thumbTag");
$this->thumbnail->setDimensions($w, $h);

/* if this is the highlight, remake it */
***************
*** 499,504 ****
--- 504,513 ----

function isMovie() {
return isMovie($this->image->type);
+ }
+
+ function isNoDisplayImage() {
+ return isNoDisplayImage($this->image->type);
}

function resize($dir, $target, $pathToResized="") {
</TD></TR></TABLE><!-- BBCode End -->

 
Gaile

Joined: 2002-07-20
Posts: 1301
Posted: Tue, 2003-03-25 18:53

Thanks for the info, Joan.

However, with regards to this:

Quote:
My users want it so they can share Photoshop techniques. I think it is just too clumsy to be useful.

I agree with you. Since what is useful about the psd files are the layers and you cannot see the actual layers on a web browser, it makes more sense to offer a jpg or gif version to illustrate the point and offer the psd image as a downloadable file.

Makes more sense for that purpose at least.

Gaile

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Thu, 2003-03-27 10:56

The above code is a patch file. On Unix/Linux, save it as psd.patch and then
patch -p0 <psd.patch

However, it's just a hint of how to start - you'll need to do more work. I've abandoned it.

If you want to discuss this further, we should do it in the customization forum.

 
Pulver

Joined: 2003-03-18
Posts: 14
Posted: Fri, 2003-03-28 09:14

Im having problem with the patch file

It took me some time to test it since I made a fresh install of Mandrake 9.1 yesterday :wink:

When I apply the patch it says:

"patch unexpectadly ends in middle of line
patch: **** Only garbage was found in the patch input."

What could be the problem? - (even if I know that the patch needs more work)

But - maybe we should move this discussion to the customization forum - like you say joan?

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Fri, 2003-03-28 10:29

I'm not supporting this.

But you have to remove all the blank lines that were inserted when it was uploaded.

 
Pulver

Joined: 2003-03-18
Posts: 14
Posted: Fri, 2003-03-28 16:56

Well, I finally got the patch file working :smile: (with some manual editing)

Thanks joan! - its nice to see that my idea probably is possible.

The PSD to jpeg-thumbnail works great but the resized and full size image only works from time to time :smile: - I do not know if that is because I did something wrong or because it needs to be worked on.

If I am succesful in adding some more features, like a download option of the org PSD file etc - I will start a topic in the customization forum :smile:

I wonder if I should suggest this as a feature for v2 ?

 
jonmorra

Joined: 2003-06-04
Posts: 18
Posted: Thu, 2003-06-05 19:28

Pulver, I also have the same problem that you have. I have a large database of images stored in many different kinds of formats. I want Gallery to display a .gif of them then when they are clicked on to have a link to the original format. Could you let me know the process you took to get this to work.

Thanks

 
shafiqsust

Joined: 2008-06-02
Posts: 1
Posted: Mon, 2008-06-02 11:31

Pulver,
I want to see the thumbnail of psd.please can u help me.