protected override void PullImageProperties() { PngHeader png = new PngHeader(Stream); foreach (PngFile.Chunk chunk in png.Chunks) { if (chunk is PngFile.IhdrChunk) { PngFile.IhdrChunk ihdr = (PngFile.IhdrChunk)chunk; Width = (int)ihdr.Width; Height = (int)ihdr.Height; Depth = ihdr.Depth; bool hasAlpha = false; string colorType = null; switch (ihdr.Color) { case PngFile.ColorType.Gray: colorType = "Greyscale"; hasAlpha = false; break; case PngFile.ColorType.Rgb: colorType = "Truecolor"; hasAlpha = false; break; case PngFile.ColorType.Indexed: colorType = "Indexed"; hasAlpha = false; break; case PngFile.ColorType.GrayAlpha: colorType = "Greyscale"; hasAlpha = true; break; case PngFile.ColorType.RgbA: colorType = "Truecolor"; hasAlpha = true; break; } AddProperty(Beagle.Property.NewUnsearched("fixme:colortype", colorType)); AddProperty(Beagle.Property.NewBool("fixme:hasalpha", hasAlpha)); } else if (chunk is PngFile.TextChunk) { ExtractTextProperty((PngFile.TextChunk)chunk); } } Finished(); }
protected override void PullImageProperties () { PngHeader png = new PngHeader (Stream); foreach (PngFile.Chunk chunk in png.Chunks){ if (chunk is PngFile.IhdrChunk) { PngFile.IhdrChunk ihdr = (PngFile.IhdrChunk)chunk; Width = (int)ihdr.Width; Height = (int)ihdr.Height; Depth = ihdr.Depth; bool hasAlpha = false; string colorType = null; switch (ihdr.Color) { case PngFile.ColorType.Gray: colorType = "Greyscale"; hasAlpha = false; break; case PngFile.ColorType.Rgb: colorType = "Truecolor"; hasAlpha = false; break; case PngFile.ColorType.Indexed: colorType = "Indexed"; hasAlpha = false; break; case PngFile.ColorType.GrayAlpha: colorType = "Greyscale"; hasAlpha = true; break; case PngFile.ColorType.RgbA: colorType = "Truecolor"; hasAlpha = true; break; } AddProperty (Beagle.Property.NewUnsearched ("fixme:colortype", colorType)); AddProperty (Beagle.Property.NewBool ("fixme:hasalpha", hasAlpha)); } else if (chunk is PngFile.TextChunk) { ExtractTextProperty ((PngFile.TextChunk) chunk); } } Finished (); }