JPG Image attack test code

Source: Internet
Author: User

The MATLAB code is as follows:

Close All;clear all;clc;% key=1; The%key is used to set the proportions that need to be compressed to read into the original image original String,os the original image string [filename pathname]=uigetfile (' *.bmp;*.jpg;*.tif ',' original image. jpg '); Os=[pathname filename];o=imread (OS);% read-in modified string, RS modified string [FileName,PathName]=uiputfile ({' *.bmp ';' *.jpg ';' *.tif '},' post-attack image. jpg '); rs=[PathName FileName];%%%%%%%%%%%%% Set Compression ratio prompt={' input compression ratio% '};title=' compression ratio '; lines=1; def={'};Mya=inputdlg (Prompt,title,lines, def, 'on ');key11=[mya{1}];key=str2num (KEY11);%%%%%%%%%%%%Set the compression scale imwrite (O,RS,' JPEG ',' quality ', key);% read the file just written into Rr=imread (RS); subplot (1,2,1), Imshow (o);%,title (' original image '); Set (GCA,' Title ', Text (' String ',' original image ')) Subplot (1,2,2), Imshow (RR);%,title (' compress image '); Set (GCA,' Title ', Text (' String ', [Num2str (Key)'% compressed image ']))

JPG Image attack test code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.