4

I am new to JCodec, but I am attempting to convert a JCodec Picture to a BufferedImage. Unfortunately, the methods to do so in JCodec have been deprecated, save for those methods converting a Picture to a Picture8Bit. However, I haven't found a JCodec method for the conversion of a Picture to a Picture8Bit.

tpm900
  • 271
  • 5
  • 11
  • Actually, the whole `Picture` class is deprecated, and telling you to use `Picture8Bit` instead. So, you should probably not have used `Picture` in the first place. – Harald K Nov 24 '16 at 19:54
  • 1
    The getNativeFrame() only will return a Picture – tpm900 Nov 24 '16 at 23:14

2 Answers2

2

Among the standard distribution there are submodules of JCodec like javase and android. These modules contain helper classes to convert to BufferedImages:

AWTUtil.toBufferedImage(Picture)

Latest versions (8/2017):

<dependency>
    <groupId>org.jcodec</groupId>
    <artifactId>jcodec</artifactId>
    <version>0.2.1</version>
</dependency>
<dependency>
    <groupId>org.jcodec</groupId>
    <artifactId>jcodec-javase</artifactId>
    <version>0.2.1</version>
</dependency>
<dependency>
    <groupId>org.jcodec</groupId>
    <artifactId>jcodec-android</artifactId>
    <version>0.2.1</version>
</dependency>
Thomas
  • 1,622
  • 17
  • 24
1

The classes FrameGrab and Picture are all deprecated, that is why also all methods using Picture is deprecated in AWTUtil.

Instead, use the class FrameGrab8Bit, where the getNativeFrame() method will return a Picture8Bit. Then you can easily use all the non-deprecated methods of AWTUtil.

Harald K
  • 26,314
  • 7
  • 65
  • 111