GithubHelp home page GithubHelp logo

dragon66 / icafe Goto Github PK

View Code? Open in Web Editor NEW
200.0 200.0 58.0 263.83 MB

Java library for reading, writing, converting and manipulating images and metadata

License: Eclipse Public License 1.0

Java 99.58% C 0.27% JavaScript 0.01% CSS 0.14%

icafe's People

Contributors

ben-manes avatar dicer avatar dragon66 avatar jlleitschuh avatar kabunov avatar shubhamvadhera avatar usbharu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

icafe's Issues

TIFFTweaker duplicates image data for type 6 TIFFs

Context:
I wrote a program using icafe that splits one large multipage TIFF into several smaller multipage TIFFs. I wanted to do this without decompressing the TIFFs (they mostly use type 6 JPEG compression), so I used the copyPages function from the TIFFTweaker class.

The problem:
The program worked, but the files it created were exactly twice the size they were supposed to be. After much debugging I discovered that for each page in the TIFF, there were two sets of identical image data in the file. However, only one set of image data was actually referenced by an IFD, so the extra set did not show up in any TIFF viewer or analyzer.

The solution:
I tracked down the problem to the copyPageData function. I realized that if the TIFF file uses type 6 JPEG compression, the image data is copied twice. I solved this by adding two conditionals:

  1. I added an if statement near line 460 of TIFFTweaker. I check if the image uses type 6 compression, and if it does I skip this whole block. There is no need to copy the image data here because if the compression is type 6, it will be copied later in the function.
  2. I added an if statement near line 480 of TIFFTweaker. I check if the image uses type 6 compression, and if it DOESN'T, I skip this block. The idea is to prevent non-type 6 files from copying extra data. I'm not sure if this is necessary or not.

This problem was tricky to debug, so I figured I would post it here for reference. My solution is not the most elegant, but it works. If you have any questions or suggestions just let me know.

Rewrite NativeMetadata to use an EnumMap as it's internal container

For ease of use, it would be better to use an EnumMap as the internal container for NativeMetadata. We can then create and populate the NativeMetadata inside an ImageReader and retrieve the EnumMap and query it by enum key specific for that kind of image. - may need to create enum type for GIF specific native metadata. For JPEG, use Marker as key and for PNG, use ChunkType instead. TIFF may not need NativeMetadata at all.

Performance problems with usage of icafe

Original question from Prashant Bandewar

Jan 22 at 4:18 AM

I am using the icafe 1.1 version for one of my projects. The requirement is to split a multi-page tiff file and based on a criteria split it either into single or two page tif files. The splitimages method in TiffTweaker was not useful as it will split only into single pages so I modified the TiffTweaker and gave a custom implementation for it. I created the below method to call the TiffTweaker methods.

This works fine in case of smaller files but as the size of the source tiff file grows, the performance slows down considerably. Based on the analysis so far, it seems like the FileCacheRandomAccessInputStream takes most of the processing time and while reading it is always starting from the start of the source file and creating a cache file everytime from the start of source.

For e.g. if I have 10 page source file, and it needs to be split in 5 files of two page each, during iteration 1, cache file is created with first two pages(based on the list of IFD's which contains data only for the pages to be copied either one or two objects in list) but next time, the cache is created with 4 pages and next time with 6 pages. Because of this when the input file is large, the processing slows down considerably once the number of records cross a certain threshold based system configuration.

Any help from your side would be greatly appreciated.

java
public static void createCMoDTiff(FileInputStream fin,
FileOutputStream fout, List list) throws IOException {
long startTiffSplit=System.currentTimeMillis();
RandomAccessInputStream rin = new FileCacheRandomAccessInputStream(fin,102400);
RandomAccessOutputStream rout = new FileCacheRandomAccessOutputStream(fout,102400);
// Copy the header information as is
copyHeader(rin, rout);
// copy the pages described in IFDs from inputfile to output file
copyPages(list, TIFFWriter.FIRST_WRITE_OFFSET, rin, rout);
int firstIFDOffset = list.get(0).getStartOffset();
// correct the pointer to 1st page
writeToStream(rout, firstIFDOffset);
rin.close();
rout.close();
long endTiffSplit = System.currentTimeMillis();
LOGGER.info("Time taken in ViaTiffTweaker : "+(endTiffSplit-startTiffSplit));
}

API to work with XMP data

Adobe XMP is considered a better metadata format and it support customized metadata entries. Currently "icafe" can extract, show, and insert XMP data as a whole in XML DOM format. It's better to have some API or else to manage the namespace, schema, etc. Adobe already has an API XMPCore. I am investigating more about the XMP format and may take a look at the XMPCore too.

Error generating images color tif

At the time to get a page of a PDF and apply convertToImage ( BufferedImage.TYPE_INT_RGB , 300) did not save the color image in grayscale only

ArrayIndexOutOfBoundsException when writing out tiffs across multiple threads

I'm currently using this library (1.1-SNAPSHOT) to:

  • Convert PDF to TIFF
  • Write out modified TIFFs

I am running this in a spring-boot application and exposing the above functionality as a web service.

I've just encountered an issue, that I realise has been here all along - just unbeknown to me.

The issue occurs when concurrent requests (on separate threads) come through where both threads are writing out a tiff at the same time.

The scenario :

  • Uploading 2 TIFFs at the same time - both 50 pages
  • Below exceptions thrown silently in the background
  • Both of the TIFFS are output with missing pages
java.lang.ArrayIndexOutOfBoundsException: 10104
    at com.icafe4j.image.compression.packbits.Packbits.packbits(Unknown Source)
    at com.icafe4j.image.writer.TIFFWriter.compressSample(Unknown Source)
    at com.icafe4j.image.writer.TIFFWriter.writeTrueColor(Unknown Source)
    at com.icafe4j.image.writer.TIFFWriter.writePageData(Unknown Source)
    at com.icafe4j.image.writer.TIFFWriter.writePage(Unknown Source)
    at com.icafe4j.image.tiff.TIFFTweaker.writePage(Unknown Source)
    at au.com.reecefenwick.imaging.rest.ImageController.manipulateImage(ImageController.java:147)
    at au.com.reecefenwick.imaging.rest.ImageController.drawOnImage(ImageController.java:99)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:870)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    ...

java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException

This is my code where I am reading an image from a HTTP stream, modifying the BufferedImage and writing out as a TIFF to the HTTP response.

Don't read too much into the "CustomTiffTweaker", I created that after I discovered this issue to override the behaviour of a particular method, more on that below.

private void manipulateImage(InputStream tiffInputStream,
                             HttpServletResponse response, String contentType) throws IOException {
        ImageReader reader = splitMultiPageImage(tiffInputStream);
        int totalPages = reader.getNumImages(true);

        // Prepare tiff writer
        TIFFWriter writer = new TIFFWriter();
        writer.setImageParam(buildTiffOptions()[0]);
        List<IFD> ifds = new ArrayList<IFD>();
        RandomAccessOutputStream rout = new MemoryCacheRandomAccessOutputStream(response.getOutputStream());
        int writeOffset = CustomTiffTweaker.prepareForWrite(rout);

        String ext = ".tif";
        response.setHeader("Content-Disposition", "attachment; filename=" + UUID.randomUUID() + ext);
        response.setContentType(contentType);


        for (int i = 0; i < totalPages; i++ ) {
            BufferedImage bufferedImage = reader.read(i);
            bufferedImage = imageManipulationService.drawOnImage(bufferedImage);
            writeOffset = CustomTiffTweaker.writePage(bufferedImage, rout, ifds, writeOffset, writer);
            bufferedImage = null;
        }

        CustomTiffTweaker.finishWrite(rout, ifds);
        rout.close();
        response.flushBuffer();
    }

The exception is being thrown here in this class

My attempt to debug/workaround

I created CustomTiffTweaker.java as referenced above, extending the TIFFTweaker - overriding the writePage() method and implementing a retry mechanism.

public class CustomTiffTweaker extends TIFFTweaker {

    private final Logger log = LoggerFactory.getLogger(CustomTiffTweaker.class);

    public static int writePage(BufferedImage image, RandomAccessOutputStream rout, List<IFD> ifds,
                                int writeOffset, TIFFWriter writer) throws IOException {
        int count = 0;
        int maxTries = 15;
        while(true) {
            try {
                // break out of loop, or return, on success
                writeOffset = writer.writePage(image, 0, 0, rout, writeOffset);

                ifds.add(writer.getIFD());
                return writeOffset;
            } catch (Exception e) {
                // handle exception
                System.out.println("Retrying");
                if (++count == maxTries) throw new RuntimeException("");
            }
        }
    }
}

I managed to stop the issue from happening by doing the above, which is obviously very dodgy :)

What really sucks about this issue is that is being silently consumed, with a stacktrace going to stdout.

Has anyone had similar experiences when using this library in a multi-threaded environment?

Add to maven

Hi

What are the plans to push this to regular maven so that it can be used by not using the SNAPSHOT mentioned in the README.md.

I understand that you have the last call on this but we are making use of this library but can not use oss.sonatype.org/content/repositories/snapshots. Just wondering what are the plans to push this to regular maven? I believe the library works fantastically

icafe jar is incompatible with jre1.5

Hi,

i am unable to use icafe in my project because it runs on java 1.5 version and icafe jar file is compiled with version 1.7.

can i get icafe jar file compile in 1.5.

NegativeArraySizeException when try to write XMP

Hello, it's me again. Metadata.insertXMP() produces an exception for certain images.

Problem images:
https://github.com/sinedsem/test/blob/master/1.jpg
https://github.com/sinedsem/test/blob/master/2.jpg
https://github.com/sinedsem/test/blob/master/3.jpg
https://github.com/sinedsem/test/blob/master/4.jpg

Code to reproduce issue:

    File source = new File("1.jpg");
    File destination = new File("result.jpg");

    XMPMeta xmpMeta = new XMPMetaImpl();

    ByteArrayOutputStream xmpOut = new ByteArrayOutputStream();
    XMPMetaFactory.serialize(xmpMeta, xmpOut);

    FileInputStream is = new FileInputStream(source);
    FileOutputStream os = new FileOutputStream(destination);

    Metadata.insertXMP(is, os, xmpOut.toString("utf-8"));

    is.close();
    os.close();

StackTrace (Sorry, no line numbers)

java.lang.NegativeArraySizeException: null
	at com.icafe4j.image.jpeg.JPEGTweaker.insertXMP(Unknown Source)
	at com.icafe4j.image.jpeg.JPEGTweaker.insertXMP(Unknown Source)
	at com.icafe4j.image.meta.Metadata.insertXMP(Unknown Source)

IllegalArgumentException: Copy range out of array bounds - please don't kill me :-(

Hi.. You know what happens, when about 400 users actively use your library? They find bugs...

Here I have an image: https://github.com/sinedsem/test/blob/master/5.jpg . Poor image, what happened with you? One evil user removed all metadata from you using XnView.

Now when I try to read metadata with icafe Metadata.readMetadata("5.jpg"); it throws IllegalArgumentException

java.lang.IllegalArgumentException: Copy range out of array bounds

	at com.icafe4j.util.ArrayUtils.subArray(Unknown Source)
	at com.icafe4j.image.meta.adobe.IRB.read(Unknown Source)
	at com.icafe4j.image.meta.Metadata.ensureDataRead(Unknown Source)
	at com.icafe4j.image.meta.adobe.IRB.get8BIM(Unknown Source)
	at com.icafe4j.image.jpeg.JPEGTweaker.readMetadata(Unknown Source)
	at com.icafe4j.image.meta.Metadata.readMetadata(Unknown Source)
	at com.icafe4j.image.meta.Metadata.readMetadata(Unknown Source)
	at com.icafe4j.image.meta.Metadata.readMetadata(Unknown Source)

Can this be related to #38 ? I still think that subArray method should allow copying the full length.

JPEG read support

In progress - coming to the final part of decoding Huffman code and reconstruct the YCbCr sample data. Currently, reading support for JPEG is still going through Java ImageIO.

UnsupportedOperationException from JPEGTweaker.insertExif

I am getting this exception when call insertExif from JPEGTweaker

java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableMap.put(Unknown Source)
at com.icafe4j.image.tiff.IFD.addChild(Unknown Source)
at com.icafe4j.image.jpeg.JPEGTweaker.insertExif(Unknown Source)
at arpm.image.ImageAdjuster.addMetadata(ImageAdjuster.java:215)
at arpm.image.ImageAdjuster.main(ImageAdjuster.java:363)

TIFFTweaker.splitPages doesnt release the images

Hey,

I need to make a split of a Multi TIFF, but later move the Single TIFF image to other folder, even the Multi TIFF. But the problem is tha tthe lib doesnt release some of the Single TIFF and the Multi TIFF.

I check the source, but I cant find any reason.

Thanks.

'B' char appears before unicode special symbols e. q. © symbol

This issue appears not always. Basically, it depends on image file. Some files are ok, others procudes this issue. Example of a problem file: https://github.com/sinedsem/test/blob/master/6.jpg

ArrayList<IPTCDataSet> iptcDataSets = new ArrayList<>();
iptcDataSets.add(new IPTCDataSet(IPTCApplicationTag.OBJECT_NAME, "I have ©"));
FileInputStream is = new FileInputStream("6.jpg");
FileOutputStream os = new FileOutputStream("result.jpg");
Metadata.insertIPTC(is, os, iptcDataSets, true);
is.close();
os.close();

Result: I have В©.

P. S. I really wish to prodive you more information when opening issues, but debugger goes crazy every time I try to step into icafe methods. No idea why.

java.lang.OutOfMemoryError processing large multi page PDF to TIFF

I am attempting to convert a 10mb PDF (40 pages) to a multi-page TIFF

I have the following code:

I'm using org.apache.pdfbox to process the PDF.

    public void savePdfAsTiff(PDDocument pdf, OutputStream outputStream) throws IOException {
        BufferedImage[] images = new BufferedImage[pdf.getNumberOfPages()];
        for (int i = 0; i < images.length; i++) {
            PDPage page = (PDPage) pdf.getDocumentCatalog().getAllPages()
                    .get(i);
            BufferedImage image;
            try {
                image = page.convertToImage(BufferedImage.TYPE_INT_RGB, 288); //works
                images[i] = image;
            } catch (IOException e) {
                e.printStackTrace();
                throw e;
            }
        }

        RandomAccessOutputStream rout = new MemoryCacheRandomAccessOutputStream(outputStream);

        ImageParam.ImageParamBuilder builder = ImageParam.getBuilder();
        ImageParam[] param = new ImageParam[1];
        TIFFOptions tiffOptions = new TIFFOptions();
        tiffOptions.setTiffCompression(TiffFieldEnum.Compression.CCITTFAX4);
        builder.imageOptions(tiffOptions);
        builder.colorType(ImageColorType.FULL_COLOR).ditherMatrix(DitherMatrix.getBayer8x8Diag()).applyDither(true).ditherMethod(DitherMethod.BAYER);
        param[0] = builder.build();

        TIFFTweaker.writeMultipageTIFF(rout, param, images);

        rout.close();
    }

This works quite well on smaller images.

But obviously buffering everything in memory will only get you so far, in my case I run out of heap space.

Have you got any examples to create the multipage tiff more efficiently?

Want to add some new functionalities

Hello

I want to add 2 new features to the TiffTweaker module:

  1. Ability to split the tiff file into byte array to allow in memory operations to the output file ( currently, it only writes the output to disk)
  2. Ability to split the tiff file by number of pages (for ex - splitting a 9 page tiff file into 3 files of 3 pages each, instead of 9 single page files)

I had some questions:

  1. Can I contribute these features ?
  2. Can I use JUnit unit tests ? Currently I do not see any JUnit unit tests.

A few questions about icafe

Hello @dragon66!

It's me again. I would like to thank you again for your library. I respect that you support it and keep it free and open source.

However, I can see that you are not so passionate about icafe. I don't see new features are being implemented or enhancement issues are being closed. As a developer I can fully understand you.

But I don't want this project to die, so I think I will fork it and will try to implement some features that I need and possibly add some improvements. And here I need your help:

  1. I can't debug icafe. Breakpoints in IDEA are missed and debugger walks between methods. Do you use any plugins like lombok which may affect debugging?
  2. How did you implemented all this stuff? Did you follow any documentation, standards? Can you please share the docs/articles?

Please say if you find this appropriate.
Thanks,
Denis,
StockHelper developer.

P. S. You icafe certainly deserve to be built with Maven. This will be the first improvement I am going to add.

java.lang.OutOfMemoryError: Java heap space

Hi,
In your document, you have said, " To save memory, we can also write animated GIF frame by frame!"
Can you provide an example? I'm getting Java Heap Space error due to all the images are written out in a single shot.
GIFTweaker.writeAnimatedGIF(images, delays, fout);

Thanks
Kangs

Add extra info to closed issue #29

This isn't about iCafe per se.

I would like to add some extra information to the bottom of issue #29 (which is closed) to help others who come across it, like I did.

If you can add this (or open it for a short amount of time, so I can include one more comment) I'll add the following at the very bottom:

I would like to leave a comment for anyone else who might find this while searching for a fix to their problems (like I did). The built in concurrency mechanism that dragon66 is talking about is the synchronize() block. Info about it can be found [here](https://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html).

Replace legacy test cases with JUnit tests

Current testing classes inside the cafe.test package do not provide any other ways then exception to indicate whether or not the tested unit is working. Migrating to JUnit test will solve the problem.

Write animated GIF frames one at a time

In order to reduce memory consumption, there should be a way to write animated GIF frames one at a time. Currently, "icafe" write them from an array of BufferedImages which could be a problem if lots of frames are involved or the frames are large.

Receiving the below error after downloading the jar file using mvn

Hi: The code used to work correctly, no changes made, but now I receive the below errors, can you please check:

[ERROR] [19,22] package cafe.image.gif does not exist
[ERROR] [20,17] package cafe.util does not exist
[49,32] cannot find symbol
symbol: variable FileUtils
location: class com.invitae.framework.utils.CommonUtil
[ERROR] cannot find symbol
symbol: variable GIFTweaker
location: class com.invitae.framework.utils.CommonUtil

Enhancement to extract individual GIF frame as GIFFrame

In some occasions like we want to modify an existing animated GIF, it would be ideal if we could grab the frame as GIFFrame. Then we can modify the properties such as the delay of it and save the frames back as an animated GIF.

Add better quantization algorithm

Currently, the only quantization algorithm used is "popularity". It's quick and produces good result if combined with dither process. But sometimes, when better image quality is required, we need a better algorithm. We may not even need a dither process in this case.

Can't delete anything from IPTC metadata and preserve Clipping Path.

Some people insert outlines in their JPEG images, which are named "Clipping path". There are a few articles about this, e. g. http://designus.sk/the-secret-path-of-jpg-images/

Here I have an example of image with clipping path: https://github.com/sinedsem/test/blob/master/clipping_path.jpg

In addition to clipping path, this image has one IPTC Keywords tag - keyword.
Let's say I want to remove this tag from image, but save clipping path info. Unfortunately, I can't do this.

When I call insertIPTC with update = true, clipping path is saved, but I can't delete tags, only add.
When I call with update = false, I see no way to preverve clipping path.

That's how I use it:

File source = new File("clipping_path.jpg");
File destination = new File("result.jpg");
FileInputStream is = new FileInputStream(source);

Map<MetadataType, Metadata> metadataMap = Metadata.readMetadata(is);

ArrayList<IPTCDataSet> iptcDataSets = new ArrayList<>();

// the following loop is needed to preserve all metadata but Keywords. Unfortunately, I can't retrieve clipping path from here.
if (metadataMap != null && metadataMap.get(MetadataType.IPTC) != null) {
    IPTC iptc = (IPTC) metadataMap.get(MetadataType.IPTC);
    for (Map.Entry<String, List<IPTCDataSet>> entry : iptc.getDataSets().entrySet()) {
        if (!entry.getKey().equals(IPTCApplicationTag.KEY_WORDS.getName())) {
            System.out.println(entry.getKey());
            iptcDataSets.addAll(entry.getValue());
        }
    }
}

is = new FileInputStream(source);
FileOutputStream os = new FileOutputStream(destination);

Metadata.insertIPTC(is, os, iptcDataSets, true); // this can be true or false

is.close();
os.close();

RuntimeException: XMP data size exceededs JPEG segment size

Hi @dragon66! It's me again from stockhelper again =)

As usual, file : https://github.com/sinedsem/test/blob/master/7.jpg

Stack trace:

java.lang.RuntimeException: XMP data size exceededs JPEG segment size
at com.icafe4j.image.meta.jpeg.JpegXMP.write(Unknown Source)
at com.icafe4j.image.jpeg.JPEGTweaker.insertXMP(Unknown Source)
at com.icafe4j.image.jpeg.JPEGTweaker.insertXMP(Unknown Source)
at com.icafe4j.image.meta.Metadata.insertXMP(Unknown Source)

P. S. Please find another glass of beer in your PayPal wallet =)

No instructions on what jar(s) to use...

Hi,
I want to read a jpeg from a servlet and can not find instructions on what jars to use. You have two main jars one 980kb and the other 2Mb so not sure why two and which to use and if there are more needed for compile and deploy.

RAW images

Hi,

Will you support RAW images as well ? Nice if icafe can support LibRaw. LibRaw is a libraries for developer that support most of the RAW images out there and they do support Mac and Win. too bad, there's no JNI support for this library...
http://www.libraw.org/

Thanks

Publish on Maven central or Bintray

Hi!

For easier consumption, it would be great if the Jar were hosted somewhere.
Maven central is the standard, but publishing to Bintray is much easier.
Anyway, some place where one could automatically retrieve the Jar via Maven, SBT, ... would be great!

Thanks
Martin

Logging to a logger instead of System.out

Hi,

I came across your icafe library yesterday, when I was looking for a library to handle animated gifs. I would like to use it in my project, but the scattered logging to System.out is not too handy. I would expect a library to log via slf4j or logback, allowing it to seamlessly integrate with a bigger application. Do you have plans to change it? I am thinking about forking your project on github and making some changes.

On the other hand I am also writing this issue to get in touch with you and say big thanks for sharing this code!

Cheers,
Balazs

EOFException when reading a gray 1x1 png

Hi! I am getting an exception when loading a PNG that both OSX Preview, Photoshop and Chrome can load: https://cloud.githubusercontent.com/assets/4610874/11146632/46cbeaf4-8a10-11e5-8ead-696cab4fac82.png

My code:

InputStream stream = new URL("https://cloud.githubusercontent.com/assets/4610874/11146632/46cbeaf4-8a10-11e5-8ead-696cab4fac82.png").openStream();
new PNGReader().read(stream);

Stack trace:

Cause: java.io.EOFException:
at com.icafe4j.io.IOUtils.readFully(Unknown Source)
at com.icafe4j.io.IOUtils.readFully(Unknown Source)
at com.icafe4j.io.IOUtils.readIntMM(Unknown Source)
at com.icafe4j.io.IOUtils.readUnsignedIntMM(Unknown Source)
at com.icafe4j.image.reader.PNGReader.read(Unknown Source)

This was on version 1.1-SNAPSHOT.

Failed modify WINDOWS_XP_TITLE info

Hi,

this is the code.

JpegExif exif = new JpegExif();
exif.addImageField(TiffTag.WINDOWS_XP_TITLE, FieldType.BYTE, "".getBytes("UTF-16LE"));

it managed to modify Windows XP comments, subject but failed on Authors and Title.
Please note that, all this fields already contained info. Ijust wanted to modify the info.

Any ideas ?
Thanks

Documentation Error class JPEGTweaker method insertXMP()

The Javadoc for class JPEGTweaker states for method insertXmp:

The standard part of the XMP must be a valid XMP with packet wrapper and, should already include the GUID for the ExtendedXMP in case of ExtendedXMP

Looking at the result and the source code, this seems to be incorrect. The tag xmpNote:HasExtendedXMP with the MD5 checksum is created by the function itself:
`

...
            if(extendedXmp != null) { // We have ExtendedXMP
		guid = StringUtils.generateMD5(extendedXmp);
		NodeList descriptions = xmpDoc.getElementsByTagName("rdf:Description");
		int length = descriptions.getLength();
		if(length > 0) {
			Element node = (Element)descriptions.item(length - 1);
			node.setAttribute("xmlns:xmpNote", "http://ns.adobe.com/xmp/extension/");
			node.setAttribute("xmpNote:HasExtendedXMP", guid);
		}
	}

`

It should be:
The standard part of the XMP must be a valid XMP with packet wrapper. In case of ExtendedXMP the required namespace and the tag xmpNote:HasExtendedXMP will be added.

By the way: Fantastic to have support for extended XMP in the library!

compile Java 1.6 support

This library can compile the java 1.6?

I have a problem using classes as my contender this in java 1.6

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.