Skip to content

zerohhy/android_jpegs_to_mpeg

Repository files navigation

Forked from Smart Gallery with Single and Multiple image pick action.

Android client Feature Breakdown Select Image Mode to Picking one or multiple image from android SD card In Multi image selection mode, images can be and selected or deselected after clicking After selection, clicked "ok" button to load the image(s) path to starting function (jpegCompression.CompressJpeg.start_point(path)). The function will open the image as a bitmap, then but the bitmap into a 3d rgb array. the rgb the array will be segmented and saved as csv file for debugging the rgb array is then passed into function(compressComponent(rgba[i],i)) layer by layer. compressComponent will cut each layer into 8x8 blocks, and pass the blocks into Discrete cosine transform. DCT will try to reduce the block into matrix with lower right corner values with all zero, only the useful values on the upper left corner will be written to a csv file to try reduce the over all size. after all images are processed and compressed into csv files, the bitmap images will display on the android screen.

Features

#Using multi image loading interface to implement android jpeg to mpeg compression
#loading multiple images (jpeg) combine and compress them into a mpeg video
  • luminous.ACTION_PICK for choosing single image.
  • luminous.ACTION_MULTIPLE_PICK for choosing multiple image.
  • Also custom Theme.

Screenshot- Screenshot- Screenshot

Usage

// For single image
Intent i = new Intent(Action.ACTION_PICK);
startActivityForResult(i, 100);

// For multiple images
Intent i = new Intent(Action.ACTION_MULTIPLE_PICK);
startActivityForResult(i, 200);

@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);

		if (requestCode == 100 && resultCode == Activity.RESULT_OK) {
			adapter.clear();

			viewSwitcher.setDisplayedChild(1);
			String single_path = data.getStringExtra("single_path");
			imageLoader.displayImage("file://" + single_path, imgSinglePick);

		} else if (requestCode == 200 && resultCode == Activity.RESULT_OK) {
			String[] all_path = data.getStringArrayExtra("all_path");

			ArrayList<CustomGallery> dataT = new ArrayList<CustomGallery>();

			for (String string : all_path) {
				CustomGallery item = new CustomGallery();
				item.sdcardPath = string;

				dataT.add(item);
			}

			viewSwitcher.setDisplayedChild(0);
			adapter.addAll(dataT);
		}
	}

In AndroidManifest.xml

 <activity android:name="CustomGalleryActivity" >
            <intent-filter>
                <action android:name="luminous.ACTION_PICK" />
                <action android:name="luminous.ACTION_MULTIPLE_PICK" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
 </activity>

License

Copyright 2013-2014 Bhavesh Hirpara

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

compress multiple jpegs to mpeg video on android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages