public class PngMetadata extends Object
This includes the palette (if present) and all the ancillary chunks
This class provides a wrapper over the collection of chunks of a image (read or to write) and provides some high level methods to access them
Constructor and Description |
---|
PngMetadata(ChunksList chunks) |
Modifier and Type | Method and Description |
---|---|
PngChunkPLTE |
createPLTEChunk()
Creates a new empty palette chunk, queues it for write and return it to the caller, who should fill its entries
|
PngChunkTRNS |
createTRNSChunk()
Creates a new empty TRNS chunk, queues it for write and return it to the caller, who should fill its entries
|
double[] |
getDpi()
returns -1 if not found or dimension unknown
|
PngChunkPLTE |
getPLTE()
Returns the palette chunk, if present
|
PngChunkTIME |
getTime()
null if not found
|
String |
getTimeAsString() |
PngChunkTRNS |
getTRNS()
Returns the TRNS chunk, if present
|
String |
getTxtForKey(String k)
Returns empty if not found, concatenated (with newlines) if multiple! - and trimmed
|
List<? extends PngChunkTextVar> |
getTxtsForKey(String k)
gets all text chunks with a given key
|
void |
queueChunk(PngChunk c) |
void |
queueChunk(PngChunk c,
boolean lazyOverwrite)
Queues the chunk at the writer
|
void |
setDpi(double x) |
void |
setDpi(double x,
double y) |
PngChunkTextVar |
setText(String k,
String val) |
PngChunkTextVar |
setText(String k,
String val,
boolean useLatin1,
boolean compress)
Creates a text chunk and queue it.
|
PngChunkTIME |
setTimeNow() |
PngChunkTIME |
setTimeNow(int secsAgo)
Creates a time chunk with current time, less secsAgo seconds
|
PngChunkTIME |
setTimeYMDHMS(int yearx,
int monx,
int dayx,
int hourx,
int minx,
int secx)
Creates a time chunk with diven date-time
|
public PngMetadata(ChunksList chunks)
public void queueChunk(PngChunk c, boolean lazyOverwrite)
lazyOverwrite: if true, checks if there is a queued "equivalent" chunk and if so, overwrites it. However if that not check for already written chunks.
public void queueChunk(PngChunk c)
public double[] getDpi()
public void setDpi(double x)
public void setDpi(double x, double y)
public PngChunkTIME setTimeNow(int secsAgo)
public PngChunkTIME setTimeNow()
public PngChunkTIME setTimeYMDHMS(int yearx, int monx, int dayx, int hourx, int minx, int secx)
public PngChunkTIME getTime()
public String getTimeAsString()
public PngChunkTextVar setText(String k, String val, boolean useLatin1, boolean compress)
k
- : key (latin1)val
- (arbitrary, should be latin1 if useLatin1)useLatin1
- compress
- public PngChunkTextVar setText(String k, String val)
public List<? extends PngChunkTextVar> getTxtsForKey(String k)
returns null if not found
Warning: this does not check the "lang" key of iTxt
public String getTxtForKey(String k)
Use getTxtsForKey() if you don't want this behaviour
public PngChunkPLTE getPLTE()
public PngChunkPLTE createPLTEChunk()
public PngChunkTRNS getTRNS()
public PngChunkTRNS createTRNSChunk()
Copyright © 2014. All rights reserved.