Communication between devices and data through networks have been increasing drastically in the past few decades. Encryption of data provides high level of security. This paper presents a median based technique for selective encryption where partial data of image is encrypted based on pixel values. An encrypted mask of the image is also appended with the image that specifies the pixels that are encrypted and the ones that are not. The technique results in saving the encryption data blocks to the Advanced Encryption Standard (AES) used for encrypting the data. The proposed technique shows significant reduction in the amount of data encrypted with a little overhead of the mask. Performance with different values of percentage deviation of median and block sizes are presented along with results for Entropy, Mean Square Error and Peak Signal to Noise Ratio that depict substantial level of security in partially encrypted image.