tags:

views:

57

answers:

3

If you were building an object to store a photo (for a program like photoshop) how would you design it? What properties would you take into account?

+2  A: 

One of the major things I would consider is whether the photo actually needs to be stored in the object, or whether you just need a link to a file, URL or database. Photos tend to use a lot of memory, so keeping it out of memory until you actually need to display it is probably good design.

Apart from that, I'd consider some sort of arbitrary tagging mechanism, and look at the tagging mechanisms that already exist in JPEG.

You might want to look at EXIF, one of the tagging standards to get some ideas for properties. However, new ones are invented al the time, so rather than having a property for each possibility, a more general Map based structure might be better for your object.

Nick Fortescue
Agreed! That should be the primary consideration.
Cerebrus
A: 

You should take into account the pixel format (how many bits and how they're assigned) and the color scheme (RGB, RGBA, CYMK, ...). You should also consider whether or not to store it completely in an object, or if it's better to keep it on the disk and swap when needed (usually you don't show the whole image in a program like Photoshop) since images can be quite large.

tunnuz
A: 

As @Nick suggested, some of the information you intend to store may already be available via EXIF tag information depending on your file format. Apart from that, before elaborating on properties of the said Image, it would be helpful to identify the context in which the Image object is used.

However, some general image properties that come to mind:

  • Title
  • Keywords/search strings
  • Description
  • Author information
  • Date created
  • File format
  • Width
  • Height
  • Location/Source/Url
  • Resolution (Horizontal/Vertical) in dpi
  • Bit depth
  • Number of Layers
  • Color count

...and so on.

Cerebrus