# How to add custom properties to image file?

**URL:** <https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714>\
**Category:** Rails\
**Created:** [July 30, 2007, 4:18am UTC](https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714 "2007-07-30T04:18:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [July 30, 2007, 4:18am UTC](https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714/1 "2007-07-30T04:18:56Z")

</div>

Hello,

I want to add custom properties to image files using RMagick, and  
these properties will embed into the image file directly. And later, I  
can retrieve those information back. Any idea, appreciate…

Thanks

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [July 30, 2007, 6:45am UTC](https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714/2 "2007-07-30T06:45:42Z")

</div>

Chamnap wrote:

> Hello,
> 
> I want to add custom properties to image files using RMagick, and  
> these properties will embed into the image file directly. And later, I  
> can retrieve those information back. Any idea, appreciate…

Could you elaborate on this more? Do you mean EXIF data?

Robby

–  
Robby R.  
[http://www.robbyonrails.com/](http://www.robbyonrails.com/)

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [July 30, 2007, 6:49am UTC](https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714/3 "2007-07-30T06:49:44Z")

</div>

I want to store some custom properties like copyright… and some  
other useful information that I want to show other people this image  
file is mine. EXIF data could be. And, I don’t want other people  
modified this information.

Chamnap

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [July 30, 2007, 8:18am UTC](https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714/4 "2007-07-30T08:18:03Z")

</div>

You are not talking about EXIF data. More likely, you mean IPTC. EXIF  
is almost exclusively used for digital image acquisition devices to  
record image data like camera manufacturer, lens, shutter speed,  
dimensions, and so on. IPTC is where you store captions,  
descriptions, location, keywords, etc.

If you’re bored, [IPTC Standard - IPTC](http://www.iptc.org/IPTC4XMP/) gives you the nuts and  
bolts of IPTC. This is a Wikipedia article about EXIF: http://  
[Exif - Wikipedia](http://en.wikipedia.org/wiki/Exif).

A word of caution: Be very careful when you store anything in an  
image file, as they are quite brittle and one inadvertent overwrite  
could render the file completely unusable.

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [July 30, 2007, 9:10am UTC](https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714/5 "2007-07-30T09:10:42Z")

</div>

Thanks s.ross. Maybe you’re right. But do you how to set those  
copyrights information? And I don’t allow any other people to change  
that copyright information.

Chamnap

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [July 30, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/how-to-add-custom-properties-to-image-file/110714/6 "2007-07-30T19:05:16Z")

</div>

You’re fighting an uphill battle. It is possible to change or remove  
metadata, which is the problem that people who hold copyrights to  
intellectual property face. If you are the sole contributor, embed  
the information prior to upload and hope for the best. The problem  
you face – especially with RAW images – is that the metadata is  
seldom in the same place among the different vendors’ file formats.  
That’s why Adobe and other image processing software vendors are in a  
constant chase to keep up with it.

One other slightly blunter instrument you can use is to deface any  
publicly-viewable image using a watermark, and only provide  
unblemished images to those who qualify for permission to use the  
copyright information. Also, post your policy prominently _in text_  
on each page that displays an image.

G’luck. Nobody else is doing very well with this problem. This  
discussion (also) should be taken off-list.

-s
