A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Code Examples of JpegImageParser


            ByteSource byteSource = new ByteSourceFile(imageFile);
            // Debug.debug("Source Segments:");
            // new JpegUtils().dumpJFIF(byteSource);

            Map params = new HashMap();
            String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
            assertNotNull(xmpXml);

            // Debug.debug("xmpXml", xmpXml.length());
            // Debug.debug();

            File noXmpFile = createTempFile(imageFile.getName() + ".", ".jpg");
            {
                // test remove

                OutputStream os = null;
                try
                {
                    os = new FileOutputStream(noXmpFile);
                    os = new BufferedOutputStream(os);
                    new JpegXmpRewriter().removeXmpXml(byteSource, os);
                } finally
                {
                    if (os != null) {
                        os.close();
                    }
                    os = null;
                }

                // Debug.debug("Source Segments:");
                // new JpegUtils().dumpJFIF(new ByteSourceFile(noXmpFile));

                String outXmp = new JpegImageParser().getXmpXml(
                        new ByteSourceFile(noXmpFile), params);
                assertNull(outXmp);
            }

            {
                // test update

                String newXmpXml = "test";
                File updated = createTempFile(imageFile.getName() + ".", ".jpg");
                OutputStream os = null;
                try
                {
                    os = new FileOutputStream(updated);
                    os = new BufferedOutputStream(os);
                    new JpegXmpRewriter().updateXmpXml(byteSource, os,
                            newXmpXml);
                } finally
                {
                    if (os != null) {
                        os.close();
                    }
                    os = null;
                }

                // Debug.debug("Source Segments:");
                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));

                String outXmp = new JpegImageParser().getXmpXml(
                        new ByteSourceFile(updated), params);
                assertNotNull(outXmp);
                assertEquals(outXmp, newXmpXml);
            }

            {
                // test insert

                String newXmpXml = "test";
                File updated = createTempFile(imageFile.getName() + ".", ".jpg");
                OutputStream os = null;
                try
                {
                    os = new FileOutputStream(updated);
                    os = new BufferedOutputStream(os);
                    new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(noXmpFile), os,
                            newXmpXml);
                } finally
                {
                    if (os != null) {
                        os.close();
                    }
                    os = null;
                }

                // Debug.debug("Source Segments:");
                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));

                String outXmp = new JpegImageParser().getXmpXml(
                        new ByteSourceFile(updated), params);
                assertNotNull(outXmp);
                assertEquals(outXmp, newXmpXml);
            }
        }

View Full Code Here


			ByteSource byteSource = new ByteSourceFile(imageFile);
			// Debug.debug("Source Segments:");
			// new JpegUtils().dumpJFIF(byteSource);

			Map params = new HashMap();
			String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
			assertNotNull(xmpXml);

			// Debug.debug("xmpXml", xmpXml.length());
			// Debug.debug();

			File noXmpFile = createTempFile(imageFile.getName() + ".", ".jpg");
			{
				// test remove
				
				OutputStream os = null;
				try
				{
					os = new FileOutputStream(noXmpFile);
					os = new BufferedOutputStream(os);
					new JpegXmpRewriter().removeXmpXml(byteSource, os);
				} finally
				{
					os.close();
					os = null;
				}

				// Debug.debug("Source Segments:");
				// new JpegUtils().dumpJFIF(new ByteSourceFile(noXmpFile));

				String outXmp = new JpegImageParser().getXmpXml(
						new ByteSourceFile(noXmpFile), params);
				assertNull(outXmp);
			}

			{
				// test update
				
				String newXmpXml = "test";
				File updated = createTempFile(imageFile.getName() + ".", ".jpg");
				OutputStream os = null;
				try
				{
					os = new FileOutputStream(updated);
					os = new BufferedOutputStream(os);
					new JpegXmpRewriter().updateXmpXml(byteSource, os,
							newXmpXml);
				} finally
				{
					os.close();
					os = null;
				}

				// Debug.debug("Source Segments:");
				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));

				String outXmp = new JpegImageParser().getXmpXml(
						new ByteSourceFile(updated), params);
				assertNotNull(outXmp);
				assertEquals(outXmp, newXmpXml);
			}

			{
				// test insert
				
				String newXmpXml = "test";
				File updated = createTempFile(imageFile.getName() + ".", ".jpg");
				OutputStream os = null;
				try
				{
					os = new FileOutputStream(updated);
					os = new BufferedOutputStream(os);
					new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(noXmpFile), os,
							newXmpXml);
				} finally
				{
					os.close();
					os = null;
				}

				// Debug.debug("Source Segments:");
				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));

				String outXmp = new JpegImageParser().getXmpXml(
						new ByteSourceFile(updated), params);
				assertNotNull(outXmp);
				assertEquals(outXmp, newXmpXml);
			}
		}

View Full Code Here


            boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
            params
                    .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
                            !ignoreImageData));

            JpegPhotoshopMetadata metadata = new JpegImageParser()
                    .getPhotoshopMetadata(byteSource, params);
            assertNotNull(metadata);
            // metadata.dump();

            File noIptcFile = createTempFile(imageFile.getName()
                    + ".iptc.remove.", ".jpg");
            {
                // test remove

                OutputStream os = null;
                try
                {
                    os = new FileOutputStream(noIptcFile);
                    os = new BufferedOutputStream(os);
                    new JpegIptcRewriter().removeIPTC(byteSource, os);
                } finally
                {
                    if (os != null) {
                        os.close();
                    }
                    os = null;
                }

                JpegPhotoshopMetadata outMetadata = new JpegImageParser()
                        .getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
                                params);
                assertTrue(outMetadata == null
                        || outMetadata.getItems().size() == 0);
            }

View Full Code Here


			boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
			params
					.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
							!ignoreImageData));

			JpegPhotoshopMetadata metadata = new JpegImageParser()
					.getPhotoshopMetadata(byteSource, params);
			assertNotNull(metadata);
			// metadata.dump();

			File noIptcFile = createTempFile(imageFile.getName()
					+ ".iptc.remove.", ".jpg");
			{
				// test remove

				OutputStream os = null;
				try
				{
					os = new FileOutputStream(noIptcFile);
					os = new BufferedOutputStream(os);
					new JpegIptcRewriter().removeIPTC(byteSource, os);
				} finally
				{
					os.close();
					os = null;
				}

				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
						.getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
								params);
				assertTrue(outMetadata == null
						|| outMetadata.getItems().size() == 0);
			}

View Full Code Here


		//		Debug.debug("possible file", file);

		try
		{
			ByteSource byteSource = new ByteSourceFile(file);
			return new JpegImageParser().hasXmpSegment(byteSource);
		}
		catch (Exception e)
		{
			//			Debug.debug("Error file", file.getAbsoluteFile());
			//			Debug.debug(e, 4);

View Full Code Here


			Debug.debug("imageFile", imageFile);
			Debug.debug();

			ByteSource byteSource = new ByteSourceFile(imageFile);
			Map params = new HashMap();
			String xmpXml = new JpegImageParser().getXmpXml(byteSource, params );
			assertNotNull(xmpXml);

			Debug.debug("xmpXml", xmpXml);
			Debug.debug();
		}

View Full Code Here


        //        Debug.debug("possible file", file);

        try
        {
            ByteSource byteSource = new ByteSourceFile(file);
            return new JpegImageParser().hasExifSegment(byteSource);
        }
        catch (Exception e)
        {
            //            Debug.debug("Error file", file.getAbsoluteFile());
            //            Debug.debug(e, 4);

View Full Code Here


		//	return false;

		try
		{
			ByteSource byteSource = new ByteSourceFile(file);
			return new JpegImageParser().hasIptcSegment(byteSource);
		}
		catch (Exception e)
		{
			//			Debug.debug("Error file", file.getAbsoluteFile());
			//			Debug.debug(e, 4);

View Full Code Here


        //    return false;

        try
        {
            ByteSource byteSource = new ByteSourceFile(file);
            return new JpegImageParser().hasIptcSegment(byteSource);
        }
        catch (Exception e)
        {
            //            Debug.debug("Error file", file.getAbsoluteFile());
            //            Debug.debug(e, 4);

View Full Code Here


		//		Debug.debug("possible file", file);

		try
		{
			ByteSource byteSource = new ByteSourceFile(file);
			return new JpegImageParser().hasExifSegment(byteSource);
		}
		catch (Exception e)
		{
			//			Debug.debug("Error file", file.getAbsoluteFile());
			//			Debug.debug(e, 4);

View Full Code Here


        //        Debug.debug("possible file", file);

        try
        {
            ByteSource byteSource = new ByteSourceFile(file);
            return new JpegImageParser().hasXmpSegment(byteSource);
        }
        catch (Exception e)
        {
            //            Debug.debug("Error file", file.getAbsoluteFile());
            //            Debug.debug(e, 4);

View Full Code Here


            Debug.debug("imageFile", imageFile);
            Debug.debug();

            ByteSource byteSource = new ByteSourceFile(imageFile);
            Map params = new HashMap();
            String xmpXml = new JpegImageParser().getXmpXml(byteSource, params );
            assertNotNull(xmpXml);

            Debug.debug("xmpXml", xmpXml);
            Debug.debug();
        }

View Full Code Here

TOP

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

TOP