FAQ
I'd like to make a change to go_image/tiff to support returning the IFD
parsed during the tiff decoding. The reason is that specific applications
can use private (or uncommon) tags. In my case, I'm processing microscopy
images where metadata about the gathering of the images is encoded in some
particular IFD tag values.

My basic idea is to add something like these types and a new Decode function

type Tag uint16

type IFDValue struct {
Datatype uint16
  Count uint32
// If Offset is -1, then Value contains the inline value of this field.
Otherwise, Offset is the location in the file where the data for this tag
is.
  Offset int64
Value [4]byte
}

type IFD struct {
UnknownTags map[Tag]IFDValue
  // Note that UintVals would replace decoder.features
UintVals map[Tag][]uint
}

func DecodeWithIFD(r io.Reader) (img image.Image, ifd IFD, err error) {


A few thoughts
* I don't love the idea of having an UnknownTags because then if the tiff
encoder ever decides to decode a tag, it would break code that is expecting
to to read some value from there. Other thoughts? Maybe break into
baseline, extension, private or something like that?
* I think you'll need the byte order to interpret any unusual tags, so I
was thinking of adding
byteOrder binary.ByteOrder
to IFD. This duplicates something in decoder already, but that didn't seem
too bad.
* It appears to me that the go_image/tiff does not support multiple IFDs.
This looks like a simple oversight that I can fix (see TIff 6.0 spec page
14)

--
Patrick Riley
pfr@google.com

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Robert Carlsen at Jan 23, 2014 at 8:45 pm
    My goexif project (https://github.com/rwcarlsen/goexif) has a (sub)package
    for generic tiff ifd, tag decoding. You can "go get
    github.com/rwcarlsen/goexif/tiff" to check it out.
    On Thursday, January 23, 2014 1:18:28 PM UTC-6, Patrick Riley wrote:

    I'd like to make a change to go_image/tiff to support returning the IFD
    parsed during the tiff decoding. The reason is that specific applications
    can use private (or uncommon) tags. In my case, I'm processing microscopy
    images where metadata about the gathering of the images is encoded in some
    particular IFD tag values.

    My basic idea is to add something like these types and a new Decode
    function

    type Tag uint16

    type IFDValue struct {
    Datatype uint16
    Count uint32
    // If Offset is -1, then Value contains the inline value of this field.
    Otherwise, Offset is the location in the file where the data for this tag
    is.
    Offset int64
    Value [4]byte
    }

    type IFD struct {
    UnknownTags map[Tag]IFDValue
    // Note that UintVals would replace decoder.features
    UintVals map[Tag][]uint
    }

    func DecodeWithIFD(r io.Reader) (img image.Image, ifd IFD, err error) {


    A few thoughts
    * I don't love the idea of having an UnknownTags because then if the tiff
    encoder ever decides to decode a tag, it would break code that is expecting
    to to read some value from there. Other thoughts? Maybe break into
    baseline, extension, private or something like that?
    * I think you'll need the byte order to interpret any unusual tags, so I
    was thinking of adding
    byteOrder binary.ByteOrder
    to IFD. This duplicates something in decoder already, but that didn't seem
    too bad.
    * It appears to me that the go_image/tiff does not support multiple IFDs.
    This looks like a simple oversight that I can fix (see TIff 6.0 spec page
    14)

    --
    Patrick Riley
    p...@google.com <javascript:>
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Patrick Riley at Jan 30, 2014 at 11:58 pm
    Great. I started using this (though I still think this should be
    incorporated in the go_image/tiff library so I might try to put that
    together).

    I sent you a pull request with a few minor updates.
    On Thursday, January 23, 2014 12:45:03 PM UTC-8, Robert Carlsen wrote:

    My goexif project (https://github.com/rwcarlsen/goexif) has a
    (sub)package for generic tiff ifd, tag decoding. You can "go get
    github.com/rwcarlsen/goexif/tiff" to check it out.
    On Thursday, January 23, 2014 1:18:28 PM UTC-6, Patrick Riley wrote:

    I'd like to make a change to go_image/tiff to support returning the IFD
    parsed during the tiff decoding. The reason is that specific applications
    can use private (or uncommon) tags. In my case, I'm processing microscopy
    images where metadata about the gathering of the images is encoded in some
    particular IFD tag values.

    My basic idea is to add something like these types and a new Decode
    function

    type Tag uint16

    type IFDValue struct {
    Datatype uint16
    Count uint32
    // If Offset is -1, then Value contains the inline value of this field.
    Otherwise, Offset is the location in the file where the data for this tag
    is.
    Offset int64
    Value [4]byte
    }

    type IFD struct {
    UnknownTags map[Tag]IFDValue
    // Note that UintVals would replace decoder.features
    UintVals map[Tag][]uint
    }

    func DecodeWithIFD(r io.Reader) (img image.Image, ifd IFD, err error) {


    A few thoughts
    * I don't love the idea of having an UnknownTags because then if the tiff
    encoder ever decides to decode a tag, it would break code that is expecting
    to to read some value from there. Other thoughts? Maybe break into
    baseline, extension, private or something like that?
    * I think you'll need the byte order to interpret any unusual tags, so I
    was thinking of adding
    byteOrder binary.ByteOrder
    to IFD. This duplicates something in decoder already, but that didn't
    seem too bad.
    * It appears to me that the go_image/tiff does not support multiple IFDs.
    This looks like a simple oversight that I can fix (see TIff 6.0 spec page
    14)

    --
    Patrick Riley
    p...@google.com
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 23, '14 at 7:18p
activeJan 30, '14 at 11:58p
posts3
users2
websitegolang.org

2 users in discussion

Patrick Riley: 2 posts Robert Carlsen: 1 post

People

Translate

site design / logo © 2021 Grokbase