Advertisement
image28

Photoshop OR Real

Jun 25th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.69 KB | None | 0 0
  1. // By Kevin
  2. // Old version of photoshop or real detection, might require tweaking of the sensitivity value marked by a comment bellow
  3. // requires SDL and SDL_image to compile
  4.  
  5. #include "defines.h"
  6. #include <SDL/SDL.h>
  7. #include <SDL/SDL_image.h>
  8.  
  9. int main(int argc, char *argv[])
  10. {
  11.     if ( argc < 1 )
  12.     {
  13.         printf("USAGE: %s [image file to check]\n",argv[0]);
  14.         return(1);
  15.     }else{
  16.         find(argc,argv);
  17.         return(0);
  18.     }
  19. }
  20.  
  21. int find(int argc, char *files[])
  22. {
  23.     FILE *output;
  24.     SDL_Surface *surface;
  25.     unsigned long filesize=0;
  26.     unsigned long pixel_count=0;
  27.     int start=0;
  28.     int d,i,l;
  29.     int inbyte=0;
  30.     Uint8 *pixel;
  31.     int temp=0;
  32.     long pos=0;
  33.     int count=0;
  34.     int count2=0;
  35.  
  36.     surface=IMG_Load(files[1]);
  37.     pixel_count=(surface->w*surface->h)*3;
  38.     pixel=(Uint8 *)surface->pixels;
  39.    
  40.     if( SDL_MUSTLOCK( surface ) )
  41.     { //Lock the surface
  42.         SDL_LockSurface( surface );
  43.     }
  44.    
  45.     for(l=0;l<pixel_count-64;l=l+4)
  46.     {
  47.  
  48.         for(i=0; i < 3; i++)
  49.         {
  50.             inbyte=0;
  51.             inbyte=pixel[l+i]%2;
  52.             printf("%d ",pixel[l+i]);
  53.             if ( ( inbyte != 254 ) && ( inbyte != 0 ) )
  54.             {
  55.                 if ( inbyte == pixel[l+i+3]%2 )
  56.                 {
  57.                     count++;
  58.        
  59.                 }
  60.             }
  61.                
  62.    
  63.         }
  64.    
  65.         if ( count == 3 )
  66.         {
  67.             count2++;
  68.         }else{
  69.             count2=0;
  70.         }
  71.  
  72.  
  73.         if ( count2 > 4 ) // Adjust the 4 to change sensitivity
  74.         {
  75.             printf("Photoshopped");
  76.    
  77.             if( SDL_MUSTLOCK( surface ) )
  78.             { //Lock the surface
  79.                 SDL_UnlockSurface( surface );
  80.             }
  81.            
  82.             SDL_FreeSurface(surface);
  83.             exit(-1);
  84.         }
  85.    
  86.         printf("\n");
  87.         count=0;
  88.  
  89.    
  90.         pos++;
  91.     }
  92.    
  93.    
  94.     if( SDL_MUSTLOCK( surface ) )
  95.     { //Lock the surface
  96.         SDL_UnlockSurface( surface );
  97.     }
  98.    
  99.     SDL_FreeSurface(surface);
  100.  
  101.     printf("Real");
  102.     return(0);
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement