static public CPArtwork read(InputStream is) {
		try {
			if (!readMagic(is)) {
				return null; // not a ChibiPaint file
			}

			InflaterInputStream iis = new InflaterInputStream(is);
			CPChibiChunk chunk = new CPChibiChunk(iis);
			if (!chunk.is(HEAD)) {
				return null; // not a valid file
			}

			CPChibiHeader header = new CPChibiHeader(iis, chunk);
			if ((header.version >>> 16) > 0) {
				return null; // the file version is higher than what we can deal with, bail out
			}

			CPArtwork a = new CPArtwork(header.width, header.height, 0xFFFFFFFF);
			a.layers.remove(0); // FIXME: it would be better not to have created it in the first place

			while (true) {
				chunk = new CPChibiChunk(iis);

				if (chunk.is(ZEND)) {
					break;
				} else if (chunk.is(LAYR)) {
					readLayer(iis, chunk, a);
				} else {
					realSkip(iis, chunk.chunkSize);
				}
			}

			a.setActiveLayer(0);
			return a;

		} catch (IOException e) {
			return null;
		} catch (Exception e) {
			return null;
		}
	}