登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

原来为了你

我的人生就是要一次次的超越

 
 
 

日志

 
 
 
 

获取BMP,JPG文件的宽和高  

2011-01-07 14:37:37|  分类: ABAP应用 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

datafile_tab  type standard table of x255 ,
      width     
type i,
      height    
type i,
      filelen   
type i,
      xstr      
type xstring,
      str       
type string,
      off       
type i,
      moff      
type i,
      mlen      
type i,
      
mod       type i ,
      file_off  
type i.

start
-of-selection.
  
call function 'GUI_UPLOAD'
    
exporting
      filename   
'C:\2DOGS.JPG'
      filetype   
'BIN'
    
importing
      filelength 
filelen
    
tables
      data_tab   
file_tab
    
exceptions
      
others     17.

  
call function 'SCMS_BINARY_TO_XSTRING'
    
exporting
      input_length 
filelen
    
importing
      
buffer       xstr
    
tables
      binary_tab   
file_tab.

  str 
xstr.
  
if xstr+0(2) = 'FFD8'"JPG File
    off 
0.
    
while sy-subrc 0.
      
find 'FFC0' in section offset off of str match offset moff match length mlen.
      
if sy-subrc 0.
        off 
moff + mlen.
        
mod moff mod 2.
        
if mod 0.
          file_off 
moff.
        
endif.
      
endif.
    
endwhile.
    file_off  
file_off / .
    height    
xstr+file_off(2).
    file_off  
file_off + 2.
    width     
xstr+file_off(2) .
    
write 'JPG File'.
  
elseif xstr+0(2) = '424D'"BMP File
    width   
xstr+19(1256 + xstr+18(1) .
    height  
xstr+23(1256 + xstr+22(1).
    
write 'bmp file'.
  
else.
    
write 'File type error'.
    
exit.
  
endif.
  
write/ width no-gap'*' ,height no-gap.

  评论这张
 
阅读(645)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018