Finally got the desired out.
exports.handler = function(event, context) {
var imageHex = "\x42\x4d\x3c\x00\x00\x00\x00\x00\x00\x00\x36\x00\x00\x00\x28\x00"+
"\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x18\x00\x00\x00"+
"\x00\x00\x06\x00\x00\x00\x27\x00\x00\x00\x27\x00\x00\x00\x00\x00"+
"\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00";
context.succeed({responce:imageHex,header:"image/bmp"});
};
NOTE:
If you are working with new project and you only want to get hit to your lambda function,one more trick is there. You can give any format of images like png,bmp,gif ect as escaped hexadecimal string. The only problem is that aws gateway modifies your string and sometimes you will get this image
.
So Just hide your image by using display:none CSS.
<img style="display:none" src ="http://path_to_your_code">