Reputation: 3
I would like to know that, I have an image and broken into pieces 9 * 9 stored those in bitmap array. now my question, is it possible to make zip file of those bitmap array? like, cutted_images_bitmap_array.ZIP file.
Below you can observe my code.
private void break_up_image(Bitmap Bsbmp, String Bnum) {
int rows, cols, hgt, wdt;
int number_bixs=Integer.valueOf(Bnum);
cutted_images_bitmap_array = new ArrayList<Bitmap>(number_bixs);
Bitmap Bb = Bitmap.createScaledBitmap(Bsbmp, width_img_view,height_img_view, true);
rows = cols = (int) Math.sqrt(number_bixs);
hgt = Bb.getHeight() / rows;
wdt = Bb.getWidth() / cols;
int yaxis = 0;
for (int x = 0; x < rows; x++) {
int xaxis = 0;
for (int y = 0; y < cols; y++) {
cut.add(Bitmap.createBitmap(Bb, xaxis, yaxis, wdt, hgt));
xaxis += wdt;
}
yaxis += hgt;
}
}
How to make a zip of those bitmap array? any alternative solution or suggestion i will accept.
Upvotes: 0
Views: 713
Reputation: 26
You can save them first and then Zip those individual images to zip files.
try {
FileOutputStream out = new FileOutputStream(filename);
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
} catch (Exception e) {
e.printStackTrace();
}
Upvotes: 1