In order to provide the link to the picture item instead of picture url, 
I recommend to modify SafeLinkUrl variable in ItemStyle.xsl that is used for Item Url: 

 &lt;xsl:variable name="SafeLinkUrl"&gt;
            &lt;!--xsl:call-template name="OuterTemplate.GetSafeLink"&gt;
                &lt;xsl:with-param name="UrlColumnName" select="'LinkUrl'"/&gt;
            &lt;/xsl:call-template--&gt;
            &lt;xsl:value-of select="concat($RootSiteRef,'/_layouts/CopyUtil.aspx?Use=id&amp;amp;Action=dispform&amp;amp;ItemId=',@ID,'&amp;amp;ListId=',@ListId,'&amp;amp;WebId=',@WebId,'&amp;amp;SiteId=',$SiteId,'&amp;amp;Source=',$Source)"/&gt;
        &lt;/xsl:variable&gt;


CopyUtil.aspx page

CopyUtil.aspx page is an application redirect page intended for redirection to the corresponding item or document.

The following parameters could be passed via URL:


Item ID
List ID
Web ID
Site ID
Source
List item
Action
InThisWeb


In a ContentByQueryWebPart, how to generate a link to the item's display form?
Similar to the question for eclipse, 


How can I auto-remove trailing whitespace from the entire file being edited?
How can I auto-remove trailing whitespace only from the lines I changed?

