Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: How to convert image into Hex 2 Dimensional Array? Date: Wed, 08 May 2013 12:43:55 -0400 Organization: A noiseless patient Spider Lines: 40 Message-ID: References: <41718873-b1a6-4b97-bbbb-8002c48d4e29@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 8 May 2013 16:40:12 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="6b9e92482af47766954d85fb77d372f5"; logging-data="6357"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XCRa9kj5c2mTb3R2DiuSS9XhqFIGsFFY=" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130316 Icedove/17.0.4 In-Reply-To: Cancel-Lock: sha1:P7Ri4ZB8DxoJcz/p01gvkrBlR24= Xref: csiph.com comp.lang.java.programmer:23933 On 05/08/2013 04:06 AM, lipska the kat wrote: > On 08/05/13 07:30, sout saret wrote: >> Dear Community! >> >> May you help me how to write code in java to convert image to Hex 2 >> dimensional array. I want to show format as below: > > [snip] > > hmm, sounds like homework. hmm. Sounds like the beginning of another snarky reply. > > 1. get hold of the javadoc for your chosen Java version > > Then ... > > To get you started. > > import javax.swing.ImageIcon; > > public class ImageToHex { > > public static void main(String[] args) { > > ImageIcon ii = new ImageIcon("/path/to/image.ext"); > Integer width = ii.getIconWidth(); > Integer height = ii.getIconHeight(); > Byte[][] bytes = new Byte[width][height]; > //you now have 2 dimensional array into which > //you can read your image bytes > //the rest is up to you I guess > } > } > > I'm sure there are other/better ways of doing it > WTF Why bother?