GithubHelp home page GithubHelp logo

pixymeta's People

Contributors

dragon66 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pixymeta's Issues

Inserting metadata to the place confirming better to JPEG EXIF standard

Currently, inserting of metadata to JPEG is put right before SOS segment. This is working but it's not completely conforming to the JPEG EXIF standard.

There are two reasons why the metadata are put right before the SOS segment: first, we need to read all the old metadata until the SOS segment and perhaps do update to the old data and we are only confident to assume that there would be no more metadata after the SOS segment starts; second, we are reading and writing the image simultaneously, this makes it's hard to put the metadata say after SOI, or APP0.

There is a workaround though for this issue: read the segments to a list or map until SOS, do the necessary manipulation, then write them back to a new stream along with the remaining data after the SOS segment. This way, we'll definitely need more memory but it will conform to spec.

not working with current "com.github.jai-imageio:jai-imageio-core:1.3.1"

the lib works perfect on win7-64 with the demo using

  > java  -Dfile.encoding=UTF-8 -classpath pixymeta.jar;slf4j-api-1.7.12.jar;slf4j-log4j12-1.7.12.jar;jai_imageio.jar;log4j-1.2.17.jar pixy.test.TestPixyMeta ./images/cmykjpg.jpg

if you copy the images to `pixymeta\lib\images folder

However if i replace the provided jai_imageio.jar with the current jai_imageio-core-1.3.1.jar

i get

java.lang.NullPointerException
at pixy.util.MetadataUtils.createThumbnail(Unknown Source)
at pixy.test.TestPixyMeta.createThumbnail(Unknown Source)
at pixy.test.TestPixyMeta.main(Unknown Source)

when calling

  fin = new FileInputStream("images/f1.tif");
  fout = new FileOutputStream("f1-irbthumbnail-inserted.tif");

  Metadata.insertIRBThumbnail(fin, fout, createThumbnail("images/f1.tif"));

I assume that jai_imageio.jar corresponds to
'com.sun.media:jai_imageio:1.1' which is not available any more due to jpeg200-copyright problems

Do you know any free imageio lib that let all tests pass?

I also tried to use com.twelvemonkeys.imageio:imageio-tiff:3.2.1 and got

java.lang.NegativeArraySizeException
at pixy.meta.png.PNGMeta.readChunks(PNGMeta.java:192)
at pixy.meta.png.PNGMeta.insertChunks(PNGMeta.java:74)
at pixy.meta.png.PNGMeta.insertComments(PNGMeta.java:99)
at pixy.meta.Metadata.insertComments(Metadata.java:134)

when calling

        fin = new FileInputStream("images/butterfly.png");
        fout = new FileOutputStream("comment-inserted.png");

        Metadata.insertComments(fin, fout, Arrays.asList("Comment1", "Comment2"));

License?

I'm curious to know why you chose the EPL license instead of Apache 2. Also, what factors are important to you when someone forks your project?

How to read image width and height of the JPEG part?

I want to obtain the image width and length from the JPEG directory, but pixy.meta.jpeg.JFIF has no field for that and also no method to get it.

I currently use metadata-extractor to access this field using JpegDirectory.

See this class: https://github.com/drewnoakes/metadata-extractor/blob/5773aa0e2877d5bafb091c6cbccb550ad2a58479/Source/com/drew/metadata/jpeg/JpegDirectory.java

I tried TiffTag.IMAGE_WIDTH, TiffTag.IMAGE_LENGTH, ExifTag.EXIF_IMAGE_WIDTH and ExifTag.EXIF_IMAGE_HEIGHT of MetadataType.EXIF, but these fields sometimes are null.

How to access these fields?

It's frame height and width of the SOF0 segment. It looks like that this is not made available as metadata.

Broken InteropIFD after changing orientation

I got an original.jpg which I modified by calling addImageField() and Metadata.insertExif().
This is my Kotlin code:

            val metadata = Metadata.readMetadata(bytes.inputStream())

            val exif = metadata[MetadataType.EXIF] as? Exif

            exif?.addImageField(TiffTag.ORIENTATION, FieldType.SHORT, shortArrayOf(4))

            Metadata.insertExif(
                bytes.inputStream(),
                File("modified.jpg").outputStream(),
                exif,
                true
            )

The resulting file is modified.jpg.

Comparing these with ExifTool I spot two problems:

  • The InteropIFD is broken
  • The "Rating Percent" got deleted

error running first program TestPixyMeta

I just cloned the repo (git clone https://github.com/dragon66/pixymeta.git)
Opened it in Eclipse Proton
Tried to Run TestPixyMeta.java
I get the error

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at pixy.test.TestPixyMeta.test(TestPixyMeta.java:51)

Line 51 is:
Map<MetadataType, Metadata> metadataMap = Metadata.readMetadata(args[0]);

Looks like it is expecting argments and found none.
None are defined in Run Configurations.
What are appropriate arguments?

"Premature end of SOS segment" if trying to just read the headers

For metadata parsing of cloud files I only download the JPEG header.

I can read the metadata of this file using https://github.com/drewnoakes/metadata-extractor and https://github.com/apache/commons-imaging

If I try to read this file with pixymeta I get an error:

Caused by: java.io.IOException: Premature end of SOS segment!
	at pixy.meta.jpeg.JPGMeta.readSOS(Unknown Source)
	at pixy.meta.jpeg.JPGMeta.readMetadata(Unknown Source)
	at pixy.meta.Metadata.readMetadata(Unknown Source)

Does this library try to read more than just the header? Why?

It would be way more efficient to stop reading from the inputStream when the section with header bytes are processed.

Here is a sample file:
testphoto.jpg

Supported Java version

Hi Dragon66,

I'm getting this error recently while invoking pixy.meta.MetadataMetadata.readMetadata(file):

java.lang.UnsupportedClassVersionError: pixy/meta/Metadata : Unsupported major.minor version 52.0

Does it mean that pixy does not support Java 1.7 anymore?
Any help would be appreciated.

What is MetadataType.JPG_DUCKY for?

I'm curious, could you provide information about the JPEG Ducky dataset? I tried looking it up but couldn't find any information.

Where is it used?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.