android-webp-encoder icon indicating copy to clipboard operation
android-webp-encoder copied to clipboard

Not supported FourCC: A.L.P.H.

Open sonyi opened this issue 6 years ago • 7 comments

Not supported FourCC: A.L.P.H. How to deal with it

sonyi avatar Jan 17 '19 03:01 sonyi

Same here

didi789 avatar May 22 '19 18:05 didi789

Hello @b4rtaz, Thank you for your work. Any update for alpha channel

EstebanFuentealba avatar Jul 26 '20 04:07 EstebanFuentealba

Not supported FourCC: I.C.C.P.

paktech1 avatar Sep 20 '21 12:09 paktech1

In case someone still need it:

  1. Add one more if branch at WebpContainerReader:
  if (isFourCc(fcc, 'I', 'C', 'C', 'P'))
                return readIccp();
  1. Also implement this func:
private WebpChunk readIccp() throws IOException {
        int chunkSize = readUInt32();
        WebpChunk chunk = new WebpChunk(WebpChunkType.VP8);
        chunk.isLossless = false;
        readPayload(chunkSize);
        chunk.payload = null;
        debug(String.format("iccp: bytes = %d", chunkSize));
        return chunk;
    }

P.S. Maybe will send PR later.

LionisIAm avatar Sep 28 '21 12:09 LionisIAm

In case someone still need it:

  1. Add one more if branch at WebpContainerReader:
  if (isFourCc(fcc, 'I', 'C', 'C', 'P'))
                return readIccp();
  1. Also implement this func:
private WebpChunk readIccp() throws IOException {
        int chunkSize = readUInt32();
        WebpChunk chunk = new WebpChunk(WebpChunkType.VP8);
        chunk.isLossless = false;
        readPayload(chunkSize);
        chunk.payload = null;
        debug(String.format("iccp: bytes = %d", chunkSize));
        return chunk;
    }

P.S. Maybe will send PR later.

Thanks and write for ALPHA as well please?

KishorJena avatar Mar 22 '22 19:03 KishorJena

Ok using smae code of ICCP for ALPH solved the isseu. Thanks to LionisIAm.

PS: but transparent files throws error

KishorJena avatar Mar 26 '22 06:03 KishorJena

Ok using same code of ICCP for ALPH solved the isseu. Thanks to LionisIAm.

PS: but transparent files throws error

It handles the error but It won't preserve the transparency rather it will add solid black background.

        public WebpChunk read() throws IOException {
		byte[] fcc = new byte[4];

		if (read(fcc, 4) > 0) {
                        ...
			//added
			if (isFourCc(fcc, 'I', 'C', 'C', 'P'))
				return readIccp();
			if (isFourCc(fcc, 'A', 'L', 'P', 'H'))
				return readAlph();

                        ...
		}
                ...
	}
        private WebpChunk readAlph() throws IOException {
              	int chunkSize = readUInt32();
		WebpChunk chunk = new WebpChunk(WebpChunkType.ALPH);
		readPayload(chunkSize);
		return chunk;
	}

KishorJena avatar Dec 31 '22 13:12 KishorJena