Sign in to follow this  
Followers 0
Joke758

JPG hex editor

2 posts in this topic

That's pretty funny how you can destroy a jpg file only by changing some bytes :lmao:

;By Joke758
Global $form1
#include <GUIConstants.au3>

$Form2 = GUICreate("Form1", 607, 534, 173, 107)
GUICtrlCreateLabel("JPG Hex Editor By Joke758", 144, 8, 321, 29)
GUICtrlSetFont(-1, 16, 800, 0, "Verdana")
$Edit1 = GUICtrlCreateEdit("", 8, 40, 585, 457)
$Button1 = GUICtrlCreateButton("Save", 150, 504, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Open", 250, 504, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Refresh", 350, 504, 75, 25, 0)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        
        If $msg = $button2 Then
            $open = FileOpenDialog ( "Choose a file", @scriptdir, "JPG Pictures (*.jpg)" )
            $hex = String(BinaryString(FileRead ( $open )))
            GuiCtrlSetData ( $edit1, StringTrimLeft($hex, 2) )
            If $form1 Then
                GuiDelete ( $form1 )
            EndIf
            $Form1 = GUICreate("Picture", 625, 482, 192, 125)
            $Pic1 = GUICtrlCreatePic($open, 0, 0, 625, 481, BitOR($SS_NOTIFY,$WS_GROUP))
            GUISetState(@SW_SHOW)
        EndIf
        
        If $msg = $button3 Then
            $read = '0x' & GuiCtrlRead ( $edit1 )
            $open = FileOpen ( "C:\temp.jpg", 2 )
            FileWrite ( $open, BinaryString ( $read ) )
            FileClose ( $open )
            If $form1 Then
                GuiDelete ( $form1 )
            EndIf
            $Form1 = GUICreate("Picture", 625, 482, 192, 125)
            $Pic1 = GUICtrlCreatePic("C:\temp.jpg", 0, 0, 625, 481, BitOR($SS_NOTIFY,$WS_GROUP))
            GUISetState(@SW_SHOW)
        EndIf
        
        If $msg = $button1 Then
            $save = FileSaveDialog ( "Save file..", @scriptdir, "JPG Pictures (*.jpg)" )
            $open = FileOpen ( $save, 2 )
            FileWrite ( $open, BinaryString ( $read ) )
            FileClose ( $open )
        EndIf
        
    EndSelect
WEnd
Exit

Func OnAutoitExit()
    FileDelete ( "C:\temp.jpg" )
EndFunc

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Share this post


Link to post
Share on other sites



That's pretty funny how you can destroy a jpg file only by changing some bytes :lmao:

Question: why?

Why would you want to do that? Besides, altering just about any binary file (without knowing what you are doing) is almost certain to render it useless.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0