Solution:
Please try below code.
// Add the filter to manage the p tags
add_filter( 'the_content', 'jb_remove_autop_for_image', 0 );
function jb_remove_autop_for_image( $content )
{
global $post;
// Here you can write condition as per your requirement.
// i have added example for your idea
if ( is_single() && $post->post_type == 'image' )
remove_filter('the_content', 'wpautop');
return $content;
}