[File] [PATCH] of Magdir/images Adobe Photoshop Image *.psd *.pbd *.pdd

Jörg Jenderek joerg.jen.der.ek at gmx.net
Sun May 23 15:11:37 UTC 2021


Hello,

some days ago my system with Windows 10 updates itself. When checking
the system with ccleaner many file name associations are now broken.
So i look for the reported filename extension. One file name
extension is PDD.

When running running file command version 5.40 on such examples and
related files i get an output like:

0006902.PDD:                               Adobe Photoshop Image,
					   85 x 56, RGB,
					   3x 8-bit channels
18.psd:                                    Adobe Photoshop Image,
					   3000 x 3000, RGB,
					   3x 8-bit channels
2002.PDD:                                  Adobe Photoshop Image,
					   900 x 1200, RGB,
					   3x 8-bit channels
3877134.psd:                               Adobe Photoshop Image,
					   2000 x 2000, RGB,
					   3x 8-bit channels
4998682.psd:                               Adobe Photoshop Image,
					   3556 x 2000, RGB,
					   3x 8-bit channels
abydos.psd:                                Adobe Photoshop Image,
					   800 x 600, RGBA,
					   4x 8-bit channels
blue-winter-snowflakes-background-psd.psd: Adobe Photoshop Image,
					   1600 x 1067, RGB,
					   3x 8-bit channels
ColorPubOpen.psd:                          Adobe Photoshop Image,
					   619 x 408, RGBA,
					   4x 8-bit channels
input.psd:                                 Adobe Photoshop Image,
					   70 x 46, RGB,
					   3x 8-bit channels
OCREATIVE_-_sparo_web_elements.psd:        Adobe Photoshop Image,
					   738 x 600, RGB,
					   3x 8-bit channels
ORIGINAL.PDD:                              Adobe Photoshop Image,
					   300 x 300, RGB,
					   3x 8-bit channels
PayNow.psd:                                Adobe Photoshop Image,
					   68 x 23, RGB,
					   3x 8-bit channels
PS-test1.psb:                              Adobe Photoshop Image
					   (PSB),
					   454 x 340, RGB,
					   3x 8-bit channels
sample_1920×1280.psd:                      Adobe Photoshop Image,
					   1920 x 1280, RGB,
					   3x 8-bit channels
x-fmt-92-signature-id-277.psd:             Adobe Photoshop Image


Furthermore with --extension only psd is displayed and with --apple
option only UNKNUNKN is displayed.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). This describes the
PDD examples first as "Adobe Photoshop Elements (PhotoDeluxe) image"
by definition pdd-adobe.trid.xml. Second it describes the examples
as "Adobe Photoshop image" by psd.trid.xml. By that definition all
PSD are also described (See appended pdd-trid-v.txt.gz ). It also
displays used file name extensions and related URL.

So i add inside Magdir/images that information links by additional
comment lines like:
  # URL: 	http://fileformats.archiveteam.org/wiki/PSD
  # Ref. https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
  # URL: 	http://fileformats.archiveteam.org/wiki/PhotoDeluxe
  # URL: 	http://fileformats.archiveteam.org/wiki/PSB

The identification start by lines like
   0	string		8BPS Adobe Photoshop Image
   !:mime	image/vnd.adobe.photoshop
   !:ext	psd
and later the image dimensions (1-30000 for normal PSD and 1-300000
for PSB) are shown by lines like
   >>18  belong  x \b, %d x
   >>14  belong  x %d,

So example x-fmt-92-signature-id-277.psd is described as Adobe
Photoshop Image without dimensions, but in reality this is not a real
image. It is just a short test pattern for DROID identifying tool
(See https://sourceforge.net/projects/droid/).

Furthermore on mentioned web sites there software like XnView or
ImageMagick is listed that can handle such images. With the help of
the command line tool i was able to verify information that DROID
example is not a real image by shell lines like:
	nconvert -fullinfo *.psd *.psb *.pdd
	identify -verbose *

To skip DROID x-fmt-92-signature-id-277.psd i add as second test a
check for valid image width and after mime type add line for apple
type. This now becomes like:
   0	string		8BPS
   >18	belong		>0	Adobe Photoshop
   !:mime	image/vnd.adobe.photoshop
   !:apple	????8BPS

So i look also for other Photoshop characteristic. According to
documentation at offset 6 six bytes are declared as reserved and
should be zero. This was true for all my inspected examples with one
exception sample input.psd, which is found in "t" test sub directory
of PerlMagick module of ImageMagick source package ( at least for
version 7.0.11-11). Instead nil the bytes are space characters
(0x20). So show at the end such unexpected bytes by lines like:
  >>6   bequad&0xFFffFFffFFff0000 !0 \b, at offset 6
  >>>6  belong  x	 0x%8.8x
  >>>6  beshort x   \b%4.4x

The stored version was only used once by line like
  >4   beshort 2 (PSB)
This now becomes like:
  >>4   beshort 1
  >>>34	search/0xC0d7	PHUT	Image (PhotoDeluxe)
  !:ext	pdd
  >>>34	default		x	Image
  !:ext	psd
  >>4   beshort 2 Image (PSB)
  !:ext	psb

According to document ion the version is always equal to 1, but 2 for
big dimension variant which use PSB file name extension.
According to documentation the image resources segment of PDD images
contain some blocks with a signature of "PHUT", instead of the usual
"8BIM" found in PSD images. So the PDD file format seems to be an sub
format of the Photoshop PSD format. The PDD format was used by Adobe
PhotoDeluxe raster graphics editor. It is often called Adobe
PhotoDeluxe document or image. This software is discontinued, but it
is said the Adobe Photoshop still can open and create such images.

After applying the above mentioned modifications by patch
file-5.40-images-pdd.diff then all real Adobe Photoshop (excluding
DROID x-fmt-92-signature-id-277.psd) are described with more details
like:

0006902.PDD:                                 Adobe Photoshop Image
                                              (PhotoDeluxe),
                                              85 x 56, RGB,
                                              3x 8-bit channels
18.psd:                                      Adobe Photoshop Image,
                                              3000 x 3000, RGB,
                                              3x 8-bit channels
2002.PDD:                                    Adobe Photoshop Image
                                              (PhotoDeluxe),
                                              900 x 1200, RGB,
                                              3x 8-bit channels
3877134.psd:                                 Adobe Photoshop Image,
                                              2000 x 2000, RGB,
                                              3x 8-bit channels
4998682.psd:                                 Adobe Photoshop Image,
                                              3556 x 2000, RGB,
                                              3x 8-bit channels
abydos.psd:                                  Adobe Photoshop Image,
                                              800 x 600, RGBA,
                                              4x 8-bit channels
blue-winter-snowflakes-background-psd.psd:   Adobe Photoshop Image,
                                              1600 x 1067, RGB,
                                              3x 8-bit channels
ColorPubOpen.psd:                            Adobe Photoshop Image,
                                              619 x 408, RGBA,
                                              4x 8-bit channels
input.psd:                                   Adobe Photoshop Image,
                                              70 x 46, RGB,
                                              3x 8-bit channels
                                              , at offset 6
					     0x202020202020
OCREATIVE_-_sparo_web_elements.psd:          Adobe Photoshop Image,
                                              738 x 600, RGB,
                                              3x 8-bit channels
ORIGINAL.PDD:                                Adobe Photoshop Image
                                              (PhotoDeluxe),
                                              300 x 300, RGB,
                                              3x 8-bit channels
PayNow.psd:                                  Adobe Photoshop Image,
                                              68 x 23, RGB,
                                              3x 8-bit channels
PS-test1.psb:                                Adobe Photoshop Image
                                              (PSB),
                                              454 x 340, RGB,
                                              3x 8-bit channels
sample_1920×1280.psd:                        Adobe Photoshop Image,
                                              1920 x 1280, RGB,
                                              3x 8-bit channels
x-fmt-92-signature-id-277.psd:               data


And with --extension option now i get a correct output like:
0006902.PDD:                               pdd
18.psd:                                    psd
2002.PDD:                                  pdd
3877134.psd:                               psd
4998682.psd:                               psd
abydos.psd:                                psd
blue-winter-snowflakes-background-psd.psd: psd
ColorPubOpen.psd:                          psd
input.psd:                                 psd
OCREATIVE_-_sparo_web_elements.psd:        psd
ORIGINAL.PDD:                              pdd
PayNow.psd:                                psd
PS-test1.psb:                              psb
sample_1920×1280.psd:                      psd
x-fmt-92-signature-id-277.psd:             ???

I hope my diff file can be applied in future version of file utility.

With best wishes
Jörg Jenderek
--
Jörg Jenderek


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdd-trid-v.txt.gz
Type: application/x-gzip
Size: 746 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210523/2039400f/attachment.bin>
-------------- next part --------------
--- file-5.40/magic/Magdir/images.old	2021-02-22 23:49:24 +0000
+++ file-5.40/magic/Magdir/images	2021-05-23 14:41:36 +0000
@@ -1137,26 +1137,51 @@
 # Adobe Photoshop
 # From: Asbjoern Sloth Toennesen <asbjorn at lila.io>
-0	string		8BPS Adobe Photoshop Image
+# URL: 		http://fileformats.archiveteam.org/wiki/PSD
+# Reference:	https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
+# Note:		verfied by XnView `nconvert -fullinfo *.psd *.psb *.pdd`
+#		and ImageMagick `identify -verbose *.pdd`
+0	string		8BPS
+# skip DROID x-fmt-92-signature-id-277.psd by checking valid width
+>18	belong		>0	Adobe Photoshop
 !:mime	image/vnd.adobe.photoshop
+!:apple	????8BPS
+# version: always equal to 1, but 2 for PSB
+>>4   beshort 1
+# URL: 		http://fileformats.archiveteam.org/wiki/PhotoDeluxe
+# EXTRAS/PHOTOS/DEMOPIX/ORIGINAL.PDD
+>>>34	search/0xC0d7	PHUT	Image (PhotoDeluxe)
+!:ext	pdd
+>>>34	default		x	Image
 !:ext	psd
->4   beshort 2 (PSB)
->18  belong  x \b, %d x
->14  belong  x %d,
->24  beshort 0 bitmap
->24  beshort 1 grayscale
->>12 beshort 2 with alpha
->24  beshort 2 indexed
->24  beshort 3 RGB
->>12 beshort 4 \bA
->24  beshort 4 CMYK
->>12 beshort 5 \bA
->24  beshort 7 multichannel
->24  beshort 8 duotone
->24  beshort 9 lab
->12  beshort > 1
->>12  beshort x \b, %dx
->12  beshort 1 \b,
->22  beshort x %d-bit channel
->12  beshort > 1 \bs
+# URL: 		http://fileformats.archiveteam.org/wiki/PSB
+>>4   beshort 2 Image (PSB)
+!:ext	psb
+# width in pixels: 1-30000 1-300000 for PSB
+>>18  belong  x \b, %d x
+>>14  belong  x %d,
+# The color mode; 0~Bitmap 1~Grayscale 2~Indexed 3~RGB 4~CMYK 7~Multichannel 9~Duotone 9~Lab
+>>24  beshort 0 bitmap
+>>24  beshort 1 grayscale
+# the number of channels; range is 1 to 56
+>>>12 beshort 2 with alpha
+>>24  beshort 2 indexed
+>>24  beshort 3 RGB
+>>>12 beshort 4 \bA
+>>24  beshort 4 CMYK
+>>>12 beshort 5 \bA
+>>24  beshort 7 multichannel
+>>24  beshort 8 duotone
+>>24  beshort 9 lab
+>>12  beshort > 1
+>>>12 beshort x \b, %dx
+>>12  beshort 1 \b,
+>>22  beshort x %d-bit channel
+>>12  beshort > 1 \bs
+# 6 reserved bytes; must be zero, but spaces inside ImageMagick input.psd
+# https://download.imagemagick.org/ImageMagick/download/ImageMagick-7.0.11-11.zip
+# ImageMagick-7.0.11-11\PerlMagick\t\input.psd
+>>6   bequad&0xFFffFFffFFff0000 !0 \b, at offset 6
+>>>6  belong  x	 0x%8.8x
+>>>6  beshort x   \b%4.4x
 
 # XV thumbnail indicator (ThMO)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.40-images-pdd.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210523/2039400f/attachment.obj>


More information about the File mailing list