LISTING PROGRAM
FORM PERTAMA :
function varargout = pertama(varargin) gui_Singleton = 1; if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before pertama is made visible.
function pertama_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn. % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to pertama (see VARARGIN)
% Choose default command line output for pertama
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes pertama wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = pertama_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output; handles.output = hObject ;
handles.citra=imread('usu.jpg'); guidata(hObject, handles);
imshow(handles.citra); guidata(hObject, handles);
% --- Executes on button press in button_Proses.
function button_Proses_Callback(hObject, eventdata, handles) proses;
close pertama;
% hObject handle to button_Proses (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
% --- Executes on button press in button_bantuan.
function button_bantuan_Callback(hObject, eventdata, handles) bantuan;
close pertama;
% hObject handle to button_bantuan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in button_tentang.
function button_tentang_Callback(hObject, eventdata, handles)
% hObject handle to button_tentang (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
FORM PROSES :
function varargout = proses(varargin) gui_Singleton = 1; if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before proses is made visible.
function proses_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn. % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to proses (see VARARGIN)
% Choose default command line output for proses
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes proses wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = proses_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in button_pilih.
function button_pilih_Callback(hObject, eventdata, handles)
% hObject handle to button_pilih (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
global NamaFile;
[filename,pathname] = uigetfile({'*.bmp;*.jpg','File Gambar (*.bmp,*.jpg)'},'Pilih File');
NamaFile = strcat(pathname,'\',filename); [gbrAwal,Map] = imread(NamaFile);
axes(handles.axes1);
info = imfinfo([pathname,filename]); filesize = info.FileSize / 1024;
Flag = isrgb(gbrAwal);
Ukuran = [int2str(k) 'x' int2str(b)]; imshow(gbrAwal,Map);
set(handles.nama_file,'String',filename); set(handles.uk_file_asli,'String',Ukuran); set(handles.size_asli,'String',filesize);
% --- Executes on button press in button_kompresi.
function button_kompresi_Callback(hObject, eventdata, handles) start=tic;
set(handles.uk_dimensi_kompresi,'String',Ukuran); set(handles.lama_kompresi,'String',finish);
set(handles.rasio,'String',rasio);
% --- Executes on button press in button_simpan_komp.
function button_simpan_komp_Callback(hObject, eventdata, handles)
% hObject handle to button_simpan_komp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
[fileName, pathName] = uiputfile({'*.bmp','File Bitmap(*.bmp)', '*.jpg','File JPEG(*.jpg)'},'Save Image'); if isequal([fileName, pathName], [0, 0])
return else
result = getimage(handles.axes2);
imwrite(result, strcat(pathName, fileName));
info=imfinfo([pathName, fileName]); size_hasil = info.FileSize / 1024
size_asli = str2num(get(handles.size_asli,'String')) rasio= (100-(size_hasil/size_asli*100))
set(handles.size_hasil1,'String',size_hasil) set(handles.rasio,'String',rasio)
end
% --- Executes on button press in button_simpan_dekompresi.
function button_simpan_dekompresi_Callback(hObject, eventdata, handles)
% hObject handle to button_simpan_dekompresi (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
[fileName, pathName] = uiputfile({'*.bmp','File Bitmap(*.bmp)', '*.jpg','File JPEG(*.jpg)'},'Save Image');
if isequal([fileName, pathName], [0, 0]) return
else
result = getimage(handles.axes3);
imwrite(result, strcat(pathName, fileName)); info=imfinfo([pathName, fileName]);
size_hasil = info.FileSize / 1024;
set(handles.size_hasil2,'String',size_hasil) end
% --- Executes on button press in button_waktu_dekompresi.
function button_waktu_dekompresi_Callback(hObject, eventdata, handles)
% hObject handle to button_waktu_dekompresi (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
global runTimeDekomp;
% --- Executes on button press in button_waktu_kompresi.
function button_waktu_kompresi_Callback(hObject, eventdata, handles)
% hObject handle to button_waktu_kompresi (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in rasio_citra.
function rasio_citra_Callback(hObject, eventdata, handles)
% hObject handle to rasio_citra (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in button_dekompresi.
function button_dekompresi_Callback(hObject, eventdata, handles) start=tic;
Ukuran = [int2str(k) 'x' int2str(b)];
set(handles.uk_dimensi_file,'String',Ukuran); finish=toc(start);
set(handles.lama_dekompresi,'String',finish);
%runTimeDekomp = cputime-runTimeDekomp;
% --- Executes on button press in button_batal.
function button_batal_Callback(hObject, eventdata, handles)
% hObject handle to button_batal (see GCBO)
axes(handles.axes1); cla reset;
set(handles.axes1,'XTick',[]); set(handles.axes1,'YTick',[]);
% --- Executes on button press in button_Keluar.
function button_Keluar_Callback(hObject, eventdata, handles)
% hObject handle to button_Keluar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
selection=questdlg(['Keluar Aplikasi ' get(handles.figure1,'Name')''],...
['Keluar Aplikasi ' get(handles.figure1,'Name')''],... 'Ya','Tidak','Ya');
if strcmp(selection,'Tidak') return;
end
delete(handles.figure1)
% --- Executes during object creation, after setting all properties.
function size_asli_CreateFcn(hObject, eventdata, handles)
% hObject handle to size_asli (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
function size_hasil1_Callback(hObject, eventdata, handles)
% hObject handle to size_hasil1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of size_hasil1 as text
% str2double(get(hObject,'String')) returns contents of size_hasil1 as a double
% --- Executes during object creation, after setting all properties.
function size_hasil1_CreateFcn(hObject, eventdata, handles)
% hObject handle to size_hasil1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
function size_hasil2_Callback(hObject, eventdata, handles)
% hObject handle to size_hasil2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of size_hasil2 as text
% str2double(get(hObject,'String')) returns contents of size_hasil2 as a double
% --- Executes during object creation, after setting all properties.
function size_hasil2_CreateFcn(hObject, eventdata, handles)
% hObject handle to size_hasil2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in button_pertama.
function button_pertama_Callback(hObject, eventdata, handles)
% hObject handle to button_pertama (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
pertama
close proses;
% --- Executes on button press in button_bantuan.
function button_bantuan_Callback(hObject, eventdata, handles)
% hObject handle to button_bantuan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
bantuan
close proses;
function size_asli_Callback(hObject, eventdata, handles)
% hObject handle to size_asli (see GCBO)
% Hints: get(hObject,'String') returns contents of size_asli as text % str2double(get(hObject,'String')) returns contents of
size_asli as a double
% --- Executes on button press in button_tentang.
function button_tentang_Callback(hObject, eventdata, handles)
% hObject handle to button_tentang (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
tentang_aplikasi close proses;
% --- Executes on button press in MSE1.
function MSE1_Callback(hObject, eventdata, handles)
% hObject handle to MSE1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Baca Gambar Uji
global gbrAwal;
%Baca Citra Hasil
CitraHasil = getimage(handles.axes2); [mseval] = MSE(gbrAwal,CitraHasil); set(handles.nilai_MSE,'String',mseval);
% --- Executes on button press in MSE2.
function MSE2_Callback(hObject, eventdata, handles)
% hObject handle to MSE2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Baca Gambar Uji
global gbrAwal;
%Baca Citra Hasil
FORM BANTUAN :
function varargout = bantuan(varargin) gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @bantuan_OpeningFcn, ... 'gui_OutputFcn', @bantuan_OutputFcn, ... 'gui_LayoutFcn', [] , ...
'gui_Callback', []); if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before bantuan is made visible.
function bantuan_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn. % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to bantuan (see VARARGIN)
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes bantuan wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = bantuan_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
selection=questdlg(['Keluar Aplikasi ' get(handles.figure1,'Name')''],...
['Keluar Aplikasi ' get(handles.figure1,'Name')''],... 'Ya','Tidak','Ya');
return; end
delete(handles.figure1)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
pertama
close bantuan;
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
proses
close bantuan;
% --- Executes on button press in button_tentang.
function button_tentang_Callback(hObject, eventdata, handles)
% hObject handle to button_tentang (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
FORM TENTANG APLIKASI :
function varargout = tentang_aplikasi(varargin) gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @tentang_aplikasi_OpeningFcn, ...
'gui_OutputFcn', @tentang_aplikasi_OutputFcn, ... 'gui_LayoutFcn', [] , ...
'gui_Callback', []); if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before tentang_aplikasi is made visible.
function tentang_aplikasi_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn. % hObject handle to figure
% Choose default command line output for tentang_aplikasi
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes tentang_aplikasi wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = tentang_aplikasi_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in button_keluar.
function button_keluar_Callback(hObject, eventdata, handles)
% hObject handle to button_keluar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in button_proses.
function button_proses_Callback(hObject, eventdata, handles)
% hObject handle to button_proses (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
proses
close tentang_aplikasi
% --- Executes on button press in button_pertama.
function button_pertama_Callback(hObject, eventdata, handles)
% hObject handle to button_pertama (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
pertama
close tentang_aplikasi;
% --- Executes on button press in button_bantuan.
function button_bantuan_Callback(hObject, eventdata, handles)
% hObject handle to button_bantuan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
bantuan