Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split image into chunks

Tags:

android

I am attempting to split an image into pieces, lets say for example 16 chunks (4x4).Once i split the image how can i display these chunk image as a whole.

Should I use a bitmap or a drawable? Is there a method to split or will I have to make a custom method?

like image 543
AndroidDev Avatar asked Oct 10 '11 11:10

AndroidDev


People also ask

How do I split a PNG into multiple images?

Open your browser in PDF free application web site and go to Splitter tool app. Click inside the file drop area to upload PNG files or drag & drop PNG files. You can upload maximum 10 files for the operation. Click on SPLIT button.

How do I crop a picture in exactly in half?

To split images in half in Photoshop, select the marquee tool by pressing M, then click and drag over half of your image to create a rectangular selection. With the selection active, right-click and select New Layer Via Cut. This will cut the image in half and place the selected half on a new layer.

How do you split an image into 3 equal parts in Photoshop?

If you want to divide your canvas into 3 equal columns using Guides, go into the View menu and choose “New Guide…” In the New Guide dialog box enter “33.33%” in the position field, and press OK. Then repeat the same process but this time enter “66.66%” in the position field.


1 Answers

Use bitmap because it holds pixel of the image which will be good for you for future use, if you are willing to display that image.

for example ---->

 Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
   ImageView iv = (ImageView) findViewById(R.id.imageView1);
   iv.setImageBitmap(bm);

------------------------------------EDITED PART--------------------------------------------

if you want to send image from place to another(one device to another), you to convert it into byte array like this --->

Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 bm.compress(Bitmap.Compress.JPEG, 100, baos);
 byte[] b = baos.toByteArray();

and then send this to the other device.

like image 107
Rocker Avatar answered Nov 05 '22 23:11

Rocker