Click here to Skip to main content
15,886,578 members
Articles / Programming Languages / C#

Reading Adobe Photoshop images

Rate me:
Please Sign up or sign in to vote.
4.96/5 (28 votes)
3 Jul 2005CPOL2 min read 177.2K   7.8K   71  
Simple C# library for opening and displaying Adobe Photoshop images.
using System;

namespace SimplePsd
{
	/// <summary>
	/// Image resource block
	/// </summary>
	public class ImageResource
	{
		//  Image resource block
		//	Type		Name	Description
		//-------------------------------------------
		//	OSType		Type	Photoshop always uses its signature, 8BIM
		//	int16		ID		Unique identifier
		//	PString		Name	A pascal string, padded to make size even (a null name consists of two bytes of 0)
		//						Pascal style string where the first byte gives the length of the
		//						string and the content bytes follow.
		//	int32		Size	Actual size of resource data. This does not include the
		//						Type, ID, Name, or Size fields.
		//	Variable	Data	Resource data, padded to make size even

		public int nLength;
		public byte[] OSType = new byte[4];
		public short nID;
		public byte[] Name;
		public int	nSize;

		public void Reset()
		{
			nLength = -1;
			for(int i=0;i<4;i++) OSType[i] = 0x00;
			nID = -1;
			nSize = -1;
		}

		public ImageResource()
		{
			Reset();
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions